-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Help] How can I use stomp.py to subscribe and set a receiving listener to endpoint properly? #409
Comments
I did not even know if I was right, I use the python code like below: import stomp
class MyListener(stomp.ConnectionListener):
def __init__(self, conn):
self.conn = conn
def on_error(self, frame):
print('received an error "%s"' % frame.body)
def on_message(self, frame):
print('received a message "%s"' % frame.body)
if __name__ == '__main__':
connection = stomp.Connection([('127.0.0.1', 9090)], heartbeats=(4000, 4000))
connection.set_listener('/stomp-api', MyListener(connection))
connection.connect(wait=True)
connection.subscribe(destination='/topic/news', id=412, ack='auto') But received stomp.exception.ConnectFailedException always:
And my stomp server is set up using spring-boot-starter-websocket, in other words, Java. Every time the python script is run, the Java stomp server can always receive an error:
While this error not exists on connecting by JavaScript stomp client, I wonder how I can implement python stomp client properly like the one in JavaScript. |
just saw this issue. i have the same issue and am a bit stuck but thought i share where i'm at. i'm using the exact same code template as a client to connect to spring boot. it is setup for encrypted wss so i passed in the necessary SSL context/cert paths accordingly. but i keep getting the same error in the spring boot server whenever i call
i wrote a separate java client using Spring Boot's WebSocketStompClient, and it works as expected. i am running spring boot v6.3.0. now, i wonder if spring boot is expecting a different message format than the ones coded up inside stomp.py? |
In JavaScript stomp client, I can use code below to set up a listener for each receiving endpoint:
I wonder what is the equivalent code in stomp.py, thank you!
The text was updated successfully, but these errors were encountered: