konsultaner / connectanum-dart

This is a WAMP client (Web Application Messaging Protocol) implementation for the dart language and flutter projects.
MIT License
22 stars 14 forks source link

Custom HttpHeaders #20

Closed andzejsw closed 3 years ago

andzejsw commented 3 years ago

Is it possible to send custom HttpHeaders? For my project there is need to specify them.

konsultaner commented 3 years ago

You could definitly do it by extending one of the transport classes

// Start a client that connects without the usage of an authentication process
  final client1 = Client(
      // The realm to connect to
      realm: 'demo.connectanum.receive',
      // We choose WebSocket transport
      transport: MyCustomWebSocketTransport( ///<---------------- write your own
        'wss://www.connectanum.com/wamp',
        // if you want to use msgpack instead of JSON just import the serializer
        // from package:connectanum/msgpack.dart and use WebSocketSerialization.SERIALIZATION_MSGPACK
        Serializer(),
        WebSocketSerialization.SERIALIZATION_JSON,
      ));

What platform are you aiming? Maybe I can help.

andzejsw commented 3 years ago

You could definitly do it by extending one of the transport classes

// Start a client that connects without the usage of an authentication process
  final client1 = Client(
      // The realm to connect to
      realm: 'demo.connectanum.receive',
      // We choose WebSocket transport
      transport: MyCustomWebSocketTransport( ///<---------------- write your own
        'wss://www.connectanum.com/wamp',
        // if you want to use msgpack instead of JSON just import the serializer
        // from package:connectanum/msgpack.dart and use WebSocketSerialization.SERIALIZATION_MSGPACK
        Serializer(),
        WebSocketSerialization.SERIALIZATION_JSON,
      ));

What platform are you aiming? Maybe I can help.

Ok tnx. I will take a look.

andzejsw commented 3 years ago

And I want to do it on iOS.

andzejsw commented 3 years ago

It looks like, that I will need help this one. I have no idea how to add logic for my custom socket transport class, so that plugin sends specific header.

andzejsw commented 3 years ago

Big tnx. I made my own socket transport using code from WebSocketTransport class. And then added just my headers for WebSocket.connect.