I have an external publisher using REST to publish to our Crossbar Router (0.12.1)
Many of the messages being published are rather large (> 1 MB ) XML strings and arrive with a frequency of 5-10 per second.
I have written a simple twisted ApplicationRunner-based Python 2.7.4 subscriber client to monitor the messages that unfortunately intermittently drops the TCP connection. Sometimes this happens after 30+ minutes, sometimes within a minute. Unfortunately no combination of enabling the "debug" options on either router or subscriber client lends much diagnostic information as to why the connection was dropped.
1) Is there a way to better figure out why the connection keeps dropping?
2) Is there a way to initiate a reconnect when the connection does drop?
Error message, subscriber code, and router config for websocket follow.......
Thanks,
Steve
Here is the most detailed error message...
-----------------
2016-03-08T15:53:10-0500 Failing connection: 1002: RSV = 7 and no extension negotiated
2016-03-08T15:53:10-0500 dropping connection: I failed the WebSocket connection by dropping the TCP connection
2016-03-08T15:53:10-0500 Connection to/from tcp4:
127.0.0.1:8080 was aborted locally
2016-03-08T15:53:10-0500 _connectionLost: [Failure instance: Traceback (failure with no frames): <class 'twisted.internet.error.ConnectionAborted'>: Connection was aborted locally, using.]
2016-03-08T15:53:10-0500 WAMP-over-WebSocket transport lost: wasClean=False, code=1006, reason="connection was closed uncleanly (I failed the WebSocket connection by dropping the TCP connection)"
2016-03-08T15:53:10-0500 disconnected
2016-03-08T15:53:10-0500 Main loop terminated.
---------------------
Here is the subscriber client....
--------------
from __future__ import print_function
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.wamp import ApplicationSession, ApplicationRunner
from autobahn.wamp import auth
import datetime
import requests
import json
class Component(ApplicationSession):
"""
An application component that subscribes and receives events
"""
@inlineCallbacks
def onJoin(self, details):
print("session attached")
def on_eventfd(i):
print("FD " + i[0:25])
sub = yield self.subscribe(on_eventfd, 'data.farmdata')
def onConnect(self):
print("connected")
self.join(self.config.realm, [u"wampcra"], u"tester")
def onChallenge(self, challenge):
print("challenged")
if challenge.method == u"wampcra":
signature = auth.compute_wcs(u"testpassword".encode('utf8'),
challenge.extra['challenge'].encode('utf8'))
return signature.decode('ascii')
else:
raise Exception("don't know how to handle authmethod {}".format(challenge.method))
def onDisconnect(self):
print("disconnected")
self.fileout.close()
if reactor.running:
reactor.stop()
if __name__ == '__main__':
runner = ApplicationRunner(
url=u"ws://localhost:8080/fds",
realm=u"fds", debug=True, debug_app=True)
runner.run(Component)
----------------------------------------------
Here is router config for websocket:
------------------------------------------------------
"fds" : {
"type" : "websocket",
"auth" : {
"wampcra" : {
"type" : "dynamic",
"authenticator" : "fds.loggerinner"
}
},
"options" : {
"echo_close_codereason" : true
},
"debug" : true
},
-----------------------------------------