Code Monkey home page Code Monkey logo

pocket-sockets's People

Contributors

bashlund avatar filippsen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

nfacha eduardoban

pocket-sockets's Issues

Possible case of Buffer.from(undefined) on WSClient error

What

Suppose WSClient::connect successfully triggering socketHook and throwing an error during execution inside the browser:

Firefox can’t establish a connection to the server at ws://<example_host>:<example_port>/.

The following error may occur:

Uncaught TypeError: The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type undefined

Why

Considering error is defined as:

function error(error)

In cases where error.message is undefined, an error will get thrown.
According to Mozilla Developer Network, that seems to be the default in browser:

Event type
A generic Event.

Link: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/error_event

Related and possible solution

https://github.com/bashlund/pocket-sockets/blob/main/src/WSClient.ts#L141

That should be changed to prevent calling Buffer.from with bad input.
Possible fix:

this.socketError(Buffer.from(error.message ? error.message : ""));

Consider replacing testyts

There have been various issues with validation which may or may not be related to cache invalidation.

Possible alternatives:

  • mocha

server port close after time out

How could a port be closed after a certain time has elapsed without receiving data. I am using the example server "example-tcp.ts"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.