Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

a clusterWS-Client-JS implementation for uWebSockets Server #60

Open
3 tasks
pannet1 opened this issue May 10, 2020 · 0 comments
Open
3 tasks

a clusterWS-Client-JS implementation for uWebSockets Server #60

pannet1 opened this issue May 10, 2020 · 0 comments

Comments

@pannet1
Copy link

pannet1 commented May 10, 2020

Submitting

  • Bug
  • [ x] Question
  • Suggestion
  • Other

Details

Is there any example of clusterWS-Client-JS implementation for uWebSockets Server. I have basically invested some time on python server side tasks and want to read some data pushed by the websocket ###python server (not yet implemented).
`import uws
import asyncio
from time import time

Integrate with asyncio
asyncio.set_event_loop(uws.Loop())

app = uws.App({
"some": "option"
})

def getHandler(res, req):
res.end("Hello Python!")

app.get("/*", getHandler)

def listenHandler():
print(time())

app.listen("ws://localhost", 3000, listenHandler)

Run asyncio event loop
asyncio.get_event_loop().run_forever()`

#client (to be changed into standalone browser script)
`const { WebSocket } = require('@clusterws/cws');
const socket = new WebSocket('ws://localhost:3000');

socket.on('open', () => {
console.log('opened')
});

socket.on('message', (message) => {
console.log(message)
});

socket.on('error', (err) => {
console.log()
});`

###the expected work flow is as below

browser->server->login()
server->browser->success()
browser->server->subscribe(data)
server->browser->message()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant