3

I am developing an Android application and I need a Websockets framework that allows me to send cookies in the first connection of the Websocket(not in each message).

I've tried Autobahn and Java-WebSocket but they are not sending my cookies and they got no cookies support. What can I do? I don't think a WebView is a good solution for my app, since I need a service in the background always sending some messages to the Websocket.

Thank you in advance!

  • Did you try to send cookies via http headers by Java-WebSocket's `WebSocketClient` class using `WebSocketClient( URI serverUri , Draft protocolDraft , Map httpHeaders , int connectTimeout)` constructor? – Alex Salauyou Mar 27 '14 at 16:45
  • That what's exactly what I wanted! I don't know why I didn't find it in the API docs and I couldn't find it on the web. Thank you man! –  Mar 27 '14 at 18:11
  • Hi @SashaSalauyou I am using Autobahn library for websocket in Android application. Can you please tell how to send cookies using the autobahn library. – Harish Vats Jul 15 '15 at 11:09
  • @HarishVats One of the overloads of the connect method of autobahn allows you to pass a list of headers, see: https://github.com/crossbario/autobahn-android/blob/8f72ede640c6fccb6009a0bbe4d9184b4219d3c0/Autobahn/src/de/tavendo/autobahn/WebSocketConnection.java#L220 – Aidamina Oct 28 '15 at 15:15

0 Answers0