Giter Club home page Giter Club logo

Comments (6)

cboulay avatar cboulay commented on May 8, 2024

That's interesting. A friend and colleague recently developed a browser extension for BCI2000 so I know the field would fine utility in this kind of project in LSL too. But, this is the first I've heard of it, so maybe it simply hasn't occurred to anyone before.

from labstreaminglayer.

tstenner avatar tstenner commented on May 8, 2024

Anything that runs in a browser sandbox will not be able to open the sockets for network communication, so unless you have a gateway / new protocol version that uses websockets it's going to be difficult. (For the record: I think it's a good thing a browser doesn't have this kind of access to the local network.)

from labstreaminglayer.

neurobe avatar neurobe commented on May 8, 2024

Well emscripten provides at least some support for Boost.ASIO. Apparently it puts a sockets wrapper on webSockets to interface to the C code. But yes, it must then expose it to the Browser as a webSocket and the browser would then enforce same-origin policy.

For my application, and for many I would think, at least for implementing the LSL push interface, CORS (cross origin permissions (to the local network? - I guess so) to just one origin, would do the trick nicely.

I think tho, that might involve a significant change to libLSL.

Looks like I will be forced to a less elegant Electron solution to provide a separate, standalone LSL interface (that is an entirely separate app, wrapping our web App) whilst our App proper runs exquisitely in the browser - the browser in large measure performs the same function as Electron and Cmake build systems (ie cross-platform capability) but much more elegantly (without drivers, and with instant updates).
C'est la vie.

from labstreaminglayer.

tstenner avatar tstenner commented on May 8, 2024

Even then you'd have to discover the stream.

The current process is:

  • the outlet subscribes to multicast packets
  • before creating an inlet, a discovery packet is sent via broadcast/multicast
  • the outlets checks if the query matches the stream and replies with the connection parameters (IP, ports)
  • the inlet connects

So, even if you could open a plain TCP socket and get your outlets to connect to the stream, you'd still need the time offsets (which are currently synchronized via UDP), otherwise you'd just stream data without any useful time information.

The protocol for data exchange is simple and should be quite easy the replicate in javascript / typescript. The time exchange could work over TCP, but it's modeled after PTP (IEEE 1588), and a TCP exchange would need a different clock exchange and delay calculation. The outlets still wouldn't be discoverable, but scanning all IP addresses in the config file could work.

If someone were to volunteer I could mentor them, but I neither have the time nor the websockets experience to do this.

from labstreaminglayer.

neurobe avatar neurobe commented on May 8, 2024

Nice explanation - I begin to see the difficulties.
From the few tests I have done, the LSL discovery system works beautifully - that is why I was keen to participate (as well as a few customer requests!)
Early tests on the Electron package approach are positive. Might have the Inlet implemented in a day or two using Urish/Node-LSL module.

from labstreaminglayer.

dioptre avatar dioptre commented on May 8, 2024

I'm interested in this also, WASI might be useful too...

from labstreaminglayer.

Related Issues (20)

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.