I’d like to put some state information into the construction of my WebSocketClientProtocol. But haven’t found any examples of how I might do this.
Here is some code to illustrate what I would like to do.
def init(self, foo):
self.foo = foo
def onMessage(self, msg, binary):
print "Got echo: " + msg
factory = WebSocketClientFactory(“ws://localhost:9000”)
factory.protocol = MyClientProtocol
I know what foo is here. How Can I give this to this instance on MyClientProtocol ???
I suspect that I need to define my own factory and override the function that instantiates the protocol.
Any help would be really appreciated.