|
23 | 23 | class AutobahnRosBridgeProtocol(RosBridgeProtocol, WebSocketClientProtocol):
|
24 | 24 | def __init__(self, *args, **kwargs):
|
25 | 25 | super(AutobahnRosBridgeProtocol, self).__init__(*args, **kwargs)
|
26 |
| - self.headers = {} |
27 | 26 |
|
28 | 27 | def onConnect(self, response):
|
29 | 28 | LOGGER.debug("Server connected: %s", response.peer)
|
30 | 29 |
|
31 |
| - def getHandshakeRequestHeaders(self): |
32 |
| - headers = super(AutobahnRosBridgeProtocol, self).getHandshakeRequestHeaders() |
33 |
| - for key, value in self.headers.items(): |
34 |
| - headers.append((key, value)) |
35 |
| - return headers |
36 |
| - |
37 | 30 | def onOpen(self):
|
38 | 31 | LOGGER.info("Connection to ROS ready.")
|
39 | 32 | self._manual_disconnect = False
|
@@ -69,20 +62,13 @@ class AutobahnRosBridgeClientFactory(EventEmitterMixin, ReconnectingClientFactor
|
69 | 62 |
|
70 | 63 | protocol = AutobahnRosBridgeProtocol
|
71 | 64 |
|
72 |
| - def __init__(self, *args, headers=None, **kwargs): |
| 65 | + def __init__(self, *args, **kwargs): |
73 | 66 | super(AutobahnRosBridgeClientFactory, self).__init__(*args, **kwargs)
|
74 |
| - self.headers = headers or {} |
75 | 67 | self._proto = None
|
76 | 68 | self._manager = None
|
77 | 69 | self.connector = None
|
78 | 70 | self.setProtocolOptions(closeHandshakeTimeout=5)
|
79 | 71 |
|
80 |
| - def buildProtocol(self, addr): |
81 |
| - proto = self.protocol() |
82 |
| - proto.factory = self |
83 |
| - proto.headers = self.headers |
84 |
| - return proto |
85 |
| - |
86 | 72 | def connect(self):
|
87 | 73 | """Establish WebSocket connection to the ROS server defined for this factory."""
|
88 | 74 | self.connector = connectWS(self)
|
|
0 commit comments