{"action":"created","issue":{"url":"https://api.github.com/repos/audreyt/node-webworker-threads/issues/9","labels_url":"https://api.github.com/repos/audreyt/node-webworker-threads/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/audreyt/node-webworker-threads/issues/9/comments","events_url":"https://api.github.com/repos/audreyt/node-webworker-threads/issues/9/events","html_url":"https://github.com/audreyt/node-webworker-threads/issues/9","id":13341058,"number":9,"title":"Use WebSocket from within worker?","user":{"login":"FreeLiveTutor","id":1424266,"avatar_url":"https://avatars.githubusercontent.com/u/1424266?v=3","gravatar_id":"","url":"https://api.github.com/users/FreeLiveTutor","html_url":"https://github.com/FreeLiveTutor","followers_url":"https://api.github.com/users/FreeLiveTutor/followers","following_url":"https://api.github.com/users/FreeLiveTutor/following{/other_user}","gists_url":"https://api.github.com/users/FreeLiveTutor/gists{/gist_id}","starred_url":"https://api.github.com/users/FreeLiveTutor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FreeLiveTutor/subscriptions","organizations_url":"https://api.github.com/users/FreeLiveTutor/orgs","repos_url":"https://api.github.com/users/FreeLiveTutor/repos","events_url":"https://api.github.com/users/FreeLiveTutor/events{/privacy}","received_events_url":"https://api.github.com/users/FreeLiveTutor/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/audreyt/node-webworker-threads/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2013-04-18T09:30:51Z","updated_at":"2015-02-02T05:23:54Z","closed_at":null,"body":"Hi\r\n\r\nFirstly, 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.\r\n\r\nAs 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!\r\n\r\nI've come up against a challenge though, as I also require WebSockets - *initiated from within the WebWorker*.\r\n\r\nInside my worker code I have : \r\nconnection = new WebSocket( url, protocol); \r\n\r\nI've run some successfull tests from a node main thread using:\r\nvar WebSocket = require('websocket').client; [from https://github.com/Worlize/WebSocket-Node]\r\n\r\nHowever I can't use require to pull in modules into a node-webworker.\r\n\r\nCan you let me know your recommended approach to get around this?\r\n\r\nMany thanks."},"comment":{"url":"https://api.github.com/repos/audreyt/node-webworker-threads/issues/comments/72407898","html_url":"https://github.com/audreyt/node-webworker-threads/issues/9#issuecomment-72407898","issue_url":"https://api.github.com/repos/audreyt/node-webworker-threads/issues/9","id":72407898,"user":{"login":"saadnaji","id":6412555,"avatar_url":"https://avatars.githubusercontent.com/u/6412555?v=3","gravatar_id":"","url":"https://api.github.com/users/saadnaji","html_url":"https://github.com/saadnaji","followers_url":"https://api.github.com/users/saadnaji/followers","following_url":"https://api.github.com/users/saadnaji/following{/other_user}","gists_url":"https://api.github.com/users/saadnaji/gists{/gist_id}","starred_url":"https://api.github.com/users/saadnaji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saadnaji/subscriptions","organizations_url":"https://api.github.com/users/saadnaji/orgs","repos_url":"https://api.github.com/users/saadnaji/repos","events_url":"https://api.github.com/users/saadnaji/events{/privacy}","received_events_url":"https://api.github.com/users/saadnaji/received_events","type":"User","site_admin":false},"created_at":"2015-02-02T05:23:54Z","updated_at":"2015-02-02T05:23:54Z","body":"Hi audreyt,\r\n\r\nCan you explain a little bit in detail in why WebSocket implementation using node JS , for example this one:\r\n\r\nhttps://github.com/websockets/ws\r\n\r\ndoes not work in webwoker threads?.\r\n\r\nI am trying to use ws with  webwoker threads to debug and test some project that involve using these two. Although I am new NodeJS , I might offer to  help in implementing the missing stuff that web worker needs to get WebSocket needed for my own project if you explain a little bit. \r\n\r\nThank you.  "}}