SvenKirschbaum / react-stomp-hooks

This repository contain a react library which enables simple access to stomp subscriptions via hooks.
MIT License
59 stars 12 forks source link

No documentation #23

Closed Abdqadr1 closed 1 year ago

Abdqadr1 commented 1 year ago

The example doesn’t show how to send message with the hook.

SvenKirschbaum commented 1 year ago

Hello!

How to send messages is shown here: https://github.com/fallobst22/react-stomp-hooks/blob/master/example/src/App.js#L79

Abdqadr1 commented 1 year ago

Thanks. But useStompClient hook returns undefined. And in the console, an error that the websocket was closed before the connection was established. What do you think I’m doing wrong?

SvenKirschbaum commented 1 year ago

A lot of things could prevent the connection from establishing correctly. e.g. using the wrong url, a misconfiguration of the backend etc.

Abdqadr1 commented 1 year ago

I figured it out. I was updating a state on onConnect and onDisconnect props of the StompSessionProvider. Causing re rendering every time.

aalster commented 1 month ago

Send message example should be included in readme. This example is really hard to find especially if you are just looking for stomp library and didn't use it in project yet.

SvenKirschbaum commented 2 weeks ago

@aalster Thanks for the suggestions. I have added a simple sending Example to the readme.