Hi all,
I have been trying to get a WSS connection going for a couple of days now and it hasn't worked. Here's what I've got:
Original working setup:
- An internet browser (frontend) and an Arduino device (backend).
- Code based on the
serial2ws example where IoT is running serial2ws.py and the browser is running Autobahn.
- A working system under ws://
New changes:
Certs: I've added server.crt and server.key into a /keys folder on the device.
Browser autobahn: I've got (simplified):
wsuri = (document.location.protocol === "http:" ? "ws:" : "wss:") + "//" + ip + ":" + port + "/ws";
connection = new autobahn.Connection({
url: wsuri,
realm: 'realm1'});
Device serial2ws.py: mostly as in the example, except for:
# at the top
from twisted.internet import ssl
# in if __name__ == '__main__':
contextFactory = ssl.DefaultOpenSSLContextFactory('/root/keys/server.key', '/root/keys/server.crt')
parser.add_argument("--router", type=six.text_type, default=u'wss://localhost:8080/ws', help='WAMP router URL')
runner = ApplicationRunner(router, args.realm, extra={'port': args.port, 'baudrate': args.baudrate, 'debug': args.debug}, standalone=not args.router, ssl=contextFactory)
Current Status
The python server exits with:
2016-07-01 20:13:15-0400 [-] Starting factory <twisted.web.server.Site instance at 0x76dcd1c0>
2016-07-01 20:13:15-0400 [-] SSLContextFactory: <twisted.internet.ssl.DefaultOpenSSLContextFactory instance at 0x76dcd4b8>
2016-07-01 20:13:15-0400 [-] Traceback (most recent call last):
2016-07-01 20:13:15-0400 [-] File "/root/serial2ws.py", line 457, in <module>
2016-07-01 20:13:15-0400 [-] standalone=not args.router, ssl=contextFactory) # Causes error if removed
2016-07-01 20:13:15-0400 [-] TypeError: __init__() got an unexpected keyword argument 'ssl'
I've been trying LOTS of combinations of things and I'm not getting any luck yet. Any help would be greatly appreciated. Thank you!