Skip to content
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

Subscribe and publish #24

Open
theRenard opened this issue Sep 4, 2020 · 5 comments
Open

Subscribe and publish #24

theRenard opened this issue Sep 4, 2020 · 5 comments

Comments

@theRenard
Copy link

I can't get en event to fire when a client subscribe a topic but only when on that topic a message is received. Like if on('subscribe') acts more like on ('publish'). Is there an event that fires just when a user subscribes even if no messages are sent at all ?

I also don't really get how to create a topic with the the dot notation.

for instance, I could send to topic /one/two but not sure if I should listen to subscription to /one.two or one.two´ or /one/two`... could you be more explicit in the documentation or examples maybe ?

@Caleb-Bolton
Copy link

+1

@ahmed-faraz46
Copy link

+1, seems like there is no callback to tell that the topic has been subscribed. @4ib3r is this project being maintained? I want to implement it.

@ahmed-faraz46
Copy link

@Caleb-Bolton @theRenard wondering if you found any workarounds, I want to send some messages to the client as soon as a topic is subscribed.

@theRenard
Copy link
Author

Not sure 100% but I think I've moved to this https://github.com/stomp-js/stompjs

@ahmed-faraz46
Copy link

I was finally able to achieve this using middleware

function onSubscribeMiddleware(socket, args, callNext) {
  // send something to the subscriber
  return callNext(socket, args, callNext);
}

stompServer.addMiddleware('subscribe', onSubscribeMiddleware);
stompServer.subscribe('/topic/messages/#', () => {});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants