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

Non-obvious behavior in client.HandleCmd #39

Closed
sl4mmer opened this issue Nov 5, 2015 · 3 comments
Closed

Non-obvious behavior in client.HandleCmd #39

sl4mmer opened this issue Nov 5, 2015 · 3 comments

Comments

@sl4mmer
Copy link

sl4mmer commented Nov 5, 2015

How to reproduce
Using JSClient provide user or timestamp as integers
What Happens
Providing user or timestamp as integers causes following errors in client.HandleCmd respectively

json: cannot unmarshal number into Go value of type libcentrifugo.UserID
json: cannot unmarshal number into Go value of type string

Solution
Probably implict type cast in Js Client (and other lang-libraries) is the best solution...

@FZambia
Copy link
Member

FZambia commented Nov 5, 2015

Hello! User ID can be a non number, for example MongoDB object id, so explicitly providing string as it happens now seems to be a right way.

I also don't think that we need to typecast timestamp because lots of libraries in languages return timestamp with microseconds while we need only seconds. The result of type cast can be even more non obvious. I think providing utility functions like the one from centrifuge-go is a better way.

@sl4mmer
Copy link
Author

sl4mmer commented Nov 5, 2015

Then maybe let's just add a notice to JsClient documentation ?

@FZambia
Copy link
Member

FZambia commented Nov 5, 2015

Yep, commited

@FZambia FZambia closed this as completed Nov 6, 2015
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

2 participants