def _cmd_connect(self, dispatcher, frame): self.log.info("Processing CONNECT request") version = frame.headers.get("accept-version", None) if version != "1.2": res = stomp.Frame(stomp.Command.ERROR, None, "Version unsupported") else: res = stomp.Frame(stomp.Command.CONNECTED, {"version": "1.2"}) dispatcher.send_raw(res) self.log.info("CONNECT response queued") self._reactor.wakeup()
def send(self, message): self.log.debug("Sending response") res = stomp.Frame( stomp.Command.MESSAGE, { "destination": _DEFAULT_RESPONSE_DESTINATIOM, "content-type": "application/json" }, message) self._stompConn.send_raw(res)
def _cmd_connect(self, dispatcher, frame): self.log.info("Processing CONNECT request") version = frame.headers.get("accept-version", None) if version != "1.2": res = stomp.Frame(stomp.Command.ERROR, None, "Version unsupported") else: res = stomp.Frame(stomp.Command.CONNECTED, {"version": "1.2"}) cx, cy = parseHeartBeatHeader( frame.headers.get("heart-beat", "0,0")) # Make sure the heart-beat interval is sane if cy != 0: cy = max(cy, 1000) # The server can send a heart-beat every cy ms and doesn't want # to receive any heart-beat from the client. res.headers["heart-beat"] = "%d,0" % (cy, ) dispatcher.setHeartBeat(cy) dispatcher.send_raw(res) self._reactor.wakeup()