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

TypeError: Cannot call method 'send' of null #53

Open
LinusU opened this issue Sep 23, 2013 · 1 comment
Open

TypeError: Cannot call method 'send' of null #53

LinusU opened this issue Sep 23, 2013 · 1 comment

Comments

@LinusU
Copy link
Contributor

LinusU commented Sep 23, 2013

I think that this happens when the connection has been idling for too long or the internet connection has gone down and up again. I would love an automatic reconnect, which I tried to hack really quick but failed. If I have time I'll take another stab at it.

TypeError: Cannot call method 'send' of null
    at Spotify.sendCommand (node_modules/spotify-web/lib/spotify.js:492:13)
    at Spotify.sendProtobufRequest (node_modules/spotify-web/lib/spotify.js:603:8)
    at Spotify.rootlist (node_modules/spotify-web/lib/spotify.js:833:8)
@adammw
Copy link
Collaborator

adammw commented Nov 11, 2013

Like the automatic reconnect idea, not sure how feasible it is though. Like it should be easy to queue up messages, connect first then send out all buffered messages after (re)connection, however the problem I see is with all the stuff that is meant to happen after connection but before sending commands, like authentication. We could cache authentication, but I'm pretty sure we currently don't.

At the very least, I would consider this bug fixed if we start checking if the websocket object exists before sending, and if it doesn't throwing/emitting a 'not connected' exception/error.

P.S. There should have been a heartbeat going back and forth, so idling shouldn't cause the problem, more likely it was a connection failure.

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

No branches or pull requests

2 participants