Skip to content

Commit f3f683c

Browse files
Fixed building of websocket
Change-Id: I6d9c6abd0678653b584c8b46dc9e1d0626d67d01
1 parent 3ee19f1 commit f3f683c

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

websockets-server/server/example/hub/websocket.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@
2525
from twisted.web.resource import Resource
2626
from autobahn.twisted.websocket import WebSocketServerFactory, \
2727
WebSocketServerProtocol
28-
from autobahn.twisted.resource import WebSocketResource, HTTPChannelHixie76Aware
28+
from autobahn.twisted.resource import WebSocketResource
2929

30+
import txaio
31+
txaio.use_twisted()
3032

3133
DELTA = timedelta(weeks=1)
3234
SAFE_WAIT = 3
@@ -58,7 +60,7 @@ def send_to_all(msg, except_connection=None):
5860
class EchoServerProtocol(WebSocketServerProtocol):
5961

6062
def __init__(self):
61-
pass
63+
super(EchoServerProtocol, self).__init__()
6264

6365
def send_error(self, error_message):
6466
logger.error(error_message)
@@ -122,8 +124,8 @@ def onOpen(self):
122124

123125
url = "ws://%s:%d" % (host, port)
124126

125-
factory = WebSocketServerFactory(url)
126-
factory.protocol = EchoServerProtocol
127+
factory = WebSocketServerFactory(url, debug=True, debugCodePaths=True)
128+
factory.protocol = lambda: EchoServerProtocol()
127129
factory.setProtocolOptions(allowHixie76=True)
128130

129131
resource = WebSocketResource(factory)

websockets-server/server/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
author_email = "[email protected]",
2222
packages = find_packages(),
2323
license = "Apache 2.0",
24-
install_requires = ['autobahn==0.10.7', 'twisted==15.4.0', 'pyasn1', 'SQLAlchemy', 'python-daemon', 'service_identity'],
24+
install_requires = ['autobahn==0.10.7', 'twisted==15.4.0', 'pyasn1', 'SQLAlchemy', 'python-daemon', 'service_identity==14.0.0'],
2525
entry_points = {
2626
"console_scripts": [
2727
'websockets-server = example.hub:main',

0 commit comments

Comments
 (0)