4

I want to send user agent as an extra header. This is available in Eric Butlers library https://github.com/codebutler/android-websockets. Wanted to go with autobahn though. Any ideas?

chaitanyad
  • 998
  • 1
  • 9
  • 27

2 Answers2

5

You can set additional HTTP headers to be sent during the initial opening WebSocket handshake using the headers parameter to conenct - pls see here.

This probably is missing from the interface definition (a bug), but should work nevertheless.

oberstet
  • 21,353
  • 10
  • 64
  • 97
  • Thanks a lot. It helped , I had an older jar for autobahn which didnt list the interface. Following your link led me to github and the updated jar. Sorry cant seem to be able to upvote your answer, new to SO , so no reputation. – chaitanyad May 23 '14 at 06:21
  • @user3664292 great! fwiw: you cannot upvote, but you could _accept_ the answer;) – oberstet May 23 '14 at 07:13
  • Thanks very much. But can I use WSS via this version of Autobahn ? , as I read that we can't establish ssl connection so I downloaded a modified version of Autobahn which support WSS but it doesn't support headers! :(. Can you help me please ? – Ahmed Sabry Jul 09 '14 at 04:46
0

1) Yes Sure, Just download all classes from this link to any package you created before.

2) Download org.apache.http lib from this link.

3) Don't forget to download this 2 libs

4) So, the last thing that you should do - remove all

de.tavendo.autobahn.

from downloaded classes.

5) Be Happy!))

Rahim Rahimov
  • 1,347
  • 15
  • 24