Skip to content

Use WebSocket from within worker? #9

Open
@FreeLiveTutor

Description

@FreeLiveTutor

Hi

Firstly, great work. I have a huge OCD for not using 3rd party libraries, but your 'node-webworker-threads' feels like it should be part of the core node.

As context, I've written a browser based wep-app that relies on WebWorkers, and now I'm able to use your library to simulate a headless client at the server side with node, with almost no coding changes to the App. A real breakthrough for me!

I've come up against a challenge though, as I also require WebSockets - initiated from within the WebWorker.

Inside my worker code I have :
connection = new WebSocket( url, protocol);

I've run some successfull tests from a node main thread using:
var WebSocket = require('websocket').client; [from https://github.com/Worlize/WebSocket-Node]

However I can't use require to pull in modules into a node-webworker.

Can you let me know your recommended approach to get around this?

Many thanks.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions