How to set http headers / cookies sent by Client

#1

Specifically I need to be able to set cookies etc. in the HTTP headers sent with the in the Upgrade request.

I’m new to autobahn and I’m working off the basic example structure:

class TestClientProtocol(WebSocketClientProtocol):

def sendHello(self):

	self.sendMessage('hello')



def onOpen(self):

	self.sendHello()

if name == ‘main’:

factory = WebSocketClientFactory("ws://localhost:30100", debug = True)

factory.protocol = TestClientProtocol

connectWS(factory)

reactor.run()
0 Likes

#2

Specifically I need to be able to set cookies etc. in the HTTP headers
sent with the in the Upgrade request.

API for this is exposed on AutobahnPython trunk .. it's not yet there in 0.5.14 i.e.

I'm new to autobahn and I'm working off the basic example structure:

class TestClientProtocol(WebSocketClientProtocol):

def sendHello(self):
self.sendMessage('hello')
def onOpen(self):
self.sendHello()

if __name__ == '__main__':
factory = WebSocketClientFactory("ws://localhost:30100", debug = True)

factory = WebSocketClientFactory("ws://localhost:30100", debug = True, headers = {"myheader": "myvalue"})

···

Am 20.08.2013 13:29, schrieb Chris Jeffery:

factory.protocol = TestClientProtocol
connectWS(factory)
reactor.run()

--
You received this message because you are subscribed to the Google
Groups "Autobahn" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to autobahnws+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Likes