GithubHelp home page GithubHelp logo

Comments (4)

MadLittleMods avatar MadLittleMods commented on September 7, 2024

@webOS101 Pull request welcome!

from gitter-node-stream.

webOS101 avatar webOS101 commented on September 7, 2024

Understood... but, I'm actually not sure what the proper way to resolve this is. I resolved it myself by try/catch around a JSON.parse(msg) and building up the chunk if it fails, but that seems horrific. I didn't have time to look for a more elegant solution

from gitter-node-stream.

MadLittleMods avatar MadLittleMods commented on September 7, 2024

I think you may be able to delimit based on \n

The JSON stream returns messages as JSON objects that are delimited by newline (\n). Space + newline (\n) are sent as periodic "keep-alive" messages to tell clients and NAT firewalls that the connection is still alive during low message volume periods.

https://developer.gitter.im/docs/streaming-api

But you can also look to see if the last character is a }(maybe }\n) as a way to tell it is a full message


from gitter-node-stream.

webOS101 avatar webOS101 commented on September 7, 2024

There may be some assumptions about whether more than one object can be sent in a single stream that need some testing. I may give it a try to see if I can come up with something robust.

from gitter-node-stream.

Related Issues (1)

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.