Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

socket is null in send function #16

Description

@crazyyi

I have used this module in a realtime web game. The websocket module I use is uws. But sometimes I get the error saying it couldn't perform send function on null and located to this line of my code. But this doesn't happen all the time. It only happens occasionally so it is hard to reproduce. What could possibly be the reason?

      ts.send = function(socket, data) {
      	socket.send(JSON.stringify(data));
  };

The above code is similar to socket.io example in your code but I am actually using a native browser websocket implementation.

I wanted to give a uws/ws implementation example to your code but I don't have much free time at the moment.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions