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

Conditional connecting #32

Closed aalster closed 2 weeks ago

aalster commented 1 month ago

Is it possible to conditionally connect to server with this library? There is an example with conditional subscription, but StompSessionProvider doesn't have a way to connect manually (for example to request auth token before connection or simply to check if websockets are currently enabled in case they are optional).

Setting url to null or empty string will just set current page url.

SvenKirschbaum commented 2 weeks ago

Hello!

I have just released version 3.0.0, which includes a new "enabled" property on the StompSessionProvider, which can be used to control the connection state.

Please let me know if you encounter any issues with this solution.