Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Think about: Should subscribeFail trigger an error on the socket? #88

Open
jondubois opened this issue Sep 19, 2017 · 5 comments
Open

Comments

@jondubois
Copy link
Member

jondubois commented Sep 19, 2017

Right now, 'subscribeFail' does not trigger an error on the socket and it is seen as independent from the socket itself. Maybe this behaviour should change?

@odenktools
Copy link
Contributor

hai jondobois,

please add subscribe:succeeded from serverside, because if you develop an clientdriver 'subscribe success' has no callback.

maybe callback like pusher. Pusher has pusher:subscription_succeeded, pusher:subscription_error, etc

what do you think? thanks

@jondubois
Copy link
Member Author

@odenktools The server-side socket has a 'subscribe' event which triggers when the subscription succeeds (same as client socket). https://socketcluster.io/#!/docs/api-scsocket-server

You can also use the server 'subscription' event on the SCServer object to listen to subscriptions from a central place (that way you don't need to attach event handlers to individual sockets) https://socketcluster.io/#!/docs/api-scserver

Also note that the subscription cannot fail once it hits the server (that's why there is no server-side 'subscribeFail' event); the subscription can only fail if it is blocked by the user's own middleware; but in that case the user can emit their own error events if they want.

@odenktools
Copy link
Contributor

yes on server-side has subscription event, but you must emit custom callback again right?

example my client-driver:
var pongChannel = socket.subscribe('pong');

Server side

scServer.on('connection', function (socket) {
socket.on('subscription', function (data) {
socket.emit('subscription:subscription_succeeded', 'subscription_succeeded')
});
});

@jondubois
Copy link
Member Author

jondubois commented Sep 19, 2017

@odenktools When listening on the server-side socket, it is 'subscribe'. 'subscription' is when it is emitted on the server (the arguments are different). You don't need to emit a succeeded event from the server like this, you can just listen directly to the 'subscribe' event on the client-side socket.

@odenktools
Copy link
Contributor

Currently i am build client-driver for java (android) .. client driver base on pusher java libraries .. its running very well on my android project. but when i make #subscribe event on client driver it does not happen any response on my client driver . So on my serverside, im create custom callback like client: subscribesucess.

you can see @sacOO7 libraries

https://github.com/sacOO7/socketcluster-client-java/blob/master/src/main/java/io/github/sac/Parser.java#L22-L35

we dont have any subscribe_success event. we only

  • publish
  • removeAuthToken
  • setAuthToken

thanks anyway .. maybe its out of topics. Sorry for bad english

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

No branches or pull requests

2 participants