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

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

@pannet1

Description

@pannet1

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions