Closed ghost closed 8 years ago
Websockets.PCL is a wrapper around SocketRocket and AndroidAsync. Taking a look at those library we could in theory pass a dictionary of headers and cookies to the underlying implementation.
That said, I am not sure when I will have to make the changes (pretty busy at the moment). I will accept any pull requests if you want to go ahead and implement the feature.
Alternatively, you can pass your auth token as a query string or in an initial message.
Thanks for the reply.
Will look into it when I get home
Can you point me to a good starting point as I got a little lost when I looked at the source initially.
Thanks
https://github.com/NVentimiglia/Websockets.PCL/blob/master/Websockets/IWebSocketConnection.cs
Is the interface that all of the implementations implement. Open will need to include your header dictionary.
We pass this to a C# bridge. Parts of this gets auto generated by the binding library. might want to get do the next step first. https://github.com/NVentimiglia/Websockets.PCL/blob/master/Websockets.Droid/WebsocketConnection.cs
Received by a Java Bridge ( I use IntellIJ here) https://github.com/NVentimiglia/Websockets.PCL/blob/master/Websockets.DroidBridge/src/websockets/DroidBridge/BridgeController.java#L42
Use the Android Async API
https://github.com/koush/AndroidAsync
The same steps are mirrored for all the other platforms.
I did some more looking into AndroidAsync (I figured that would be the first gotcha). Im not sure now about the header support for websockets. (The API was not obvious) Will raise a question with them.
Ah ok thanks.
This seems like it would take some time. More than I have to get my app ready. So on server side I'll get it to recieve a json string and add cookies that way for now then I should be able to work on this once the app is out. Will keep you up to date
Is there a possibility of being able to access the connections headers and cookies?
As this would be very useful for cookie authenticated connections.
I myself rely on the cookie system to allow my users to connect via browser or by what I am working on currently a Xamarin Forms app.
Your websocket dll seems to be the most stable over all the others I have seen.
So I hope that I can end up using this PCL as finding PCLs that do websocket client side is dragging my development time quite a bit