106 ## start logging to console |
106 ## start logging to console |
107 # log.startLogging(sys.stdout) |
107 # log.startLogging(sys.stdout) |
108 |
108 |
109 # create a WAMP application session factory |
109 # create a WAMP application session factory |
110 component_config = types.ComponentConfig( |
110 component_config = types.ComponentConfig( |
111 realm = WSClientConf["realm"], |
111 realm=WSClientConf["realm"], |
112 extra = {"ID": WSClientConf["ID"]}) |
112 extra={"ID": WSClientConf["ID"]}) |
113 session_factory = wamp.ApplicationSessionFactory( |
113 session_factory = wamp.ApplicationSessionFactory( |
114 config = component_config) |
114 config=component_config) |
115 session_factory.session = WampSession |
115 session_factory.session = WampSession |
116 |
116 |
117 # create a WAMP-over-WebSocket transport client factory |
117 # create a WAMP-over-WebSocket transport client factory |
118 transport_factory = ReconnectingWampWebSocketClientFactory( |
118 transport_factory = ReconnectingWampWebSocketClientFactory( |
119 session_factory, |
119 session_factory, |
120 url = WSClientConf["url"], |
120 url=WSClientConf["url"], |
121 serializers = [MsgPackSerializer()], |
121 serializers=[MsgPackSerializer()], |
122 debug = False, |
122 debug=False, |
123 debug_wamp = False) |
123 debug_wamp=False) |
124 |
124 |
125 # start the client from a Twisted endpoint |
125 # start the client from a Twisted endpoint |
126 conn = connectWS(transport_factory) |
126 conn = connectWS(transport_factory) |
127 print "WAMP client connecting to :", WSClientConf["url"] |
127 print "WAMP client connecting to :", WSClientConf["url"] |
128 return conn |
128 return conn |