jasonrbriggs / stomp.py

“stomp.py” is a Python client library for accessing messaging servers (such as ActiveMQ or RabbitMQ) using the STOMP protocol (versions 1.0, 1.1 and 1.2). It can also be run as a standalone, command-line client for testing.
Apache License 2.0
491 stars 167 forks source link

TypeError during WebSocket shutdown #424

Closed Inokinoki closed 6 months ago

Inokinoki commented 1 year ago

I am using stomp.py==8.1.0 and websocket-client==1.6.0.

When I tried to disconnect from client using disconnect() method of Stomp Connection, a TypeError occurs in the loop, after receiving a receipt from server:

File "/Users/***/.venv/lib/python3.9/site-packages/stomp/transport.py", line 341, in __receiver_loop
    self.process_frame(f, frame)
  File "/Users/***/.venv/lib/python3.9/site-packages/stomp/transport.py", line 190, in process_frame
    self.notify(frame_type, f)
  File "/Users/***/.venv/lib/python3.9/site-packages/stomp/transport.py", line 213, in notify
    self.disconnect_socket()
  File "/Users/***/.venv/lib/python3.9/site-packages/stomp/adapter/ws.py", line 188, in disconnect_socket
    self.socket.shutdown(socket.SHUT_RDWR)
TypeError: shutdown() takes 1 positional argument but 2 were given

It seems that socket here is an instance of WebSocket in websocket-client, where shutdown is:

def shutdown(self):
      """
      close socket, immediately.
      """
      if self.sock:
          self.sock.close()
          self.sock = None
          self.connected = False

Is this due to an internal change from a specific version of websocket-client or an issue in stomp.py?

Inokinoki commented 1 year ago

Also created an issue in websocket-client https://github.com/websocket-client/websocket-client/issues/930

scajanus commented 6 months ago

FYI this is already fixed in the dev branch, started looking into it and found it already fixed.

Inokinoki commented 6 months ago

FYI this is already fixed in the dev branch, started looking into it and found it already fixed.

Thanks for telling!