Git Product home page Git Product logo

clusterws-client-js's Introduction

ClusterWS JavaScript Client

Build Scalable Node.js WebSockets Applications

NPM Version Maintain GitHub license

Official JavaScript Client library for ClusterWS - lightweight, fast and powerful framework for building scalable WebSockets applications in Node.js.

Find more about ClusterWS JavaScript Client in Wiki Documentation

clusterws-client-js's People

Contributors

goriunov avatar ramjak avatar rotem-bar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

clusterws-client-js's Issues

Custom Headers

Submitting

  • Bug
  • [X ] Question
  • Suggetion
  • Other

Details

Please can you explain me how I can add a custom header to pass an authorization token into header?

Cant run in Node

Submitting

  • Bug
  • Question
  • Suggetion
  • Other

Details

ReferenceError: window is not defined
    at Object.<anonymous> (node_modules/clusterws-client-js/index.js:86:14)
   at Module._compile (module.js:652:30)

Add remote start

Submitting

  • Bug
  • Question
  • Suggetion
  • Other

Details

ClusterJS v3.1.1
Linux Ubuntu 18.04

Add remote start to trigger the creation of Socket instead of connecting immediately after ClusterWS instance created. It would help rxjs to attach connect listener before the Socket connected.

AFAIK if the rxjs pipeline is too complex it will take more time before the Socket connected.

Message parsing error

Submitting

  • Bug
  • Question
  • Suggetion
  • Other

Details

  1. 3.0.4 client, 3.0.5 server
  2. Ubuntu 17.10
  3. Hi, I updated from version 2.x -> to 3.x (Server and client). When i restarting my app I got an error in the console on the Chrome "TypeError: t.subarray is not a function
    at uint8ArrayToString (index.js:9)
    at WebSocket.websocket.onmessage (index.js:141)"
    As I understood this error appears when we send message to the client.
    Example server side: socket.send('eventName', 'test message');

ClusterWS-Client-JS v3.0.6 not working on v4.0.0

Submitting

  • Bug
  • Question
  • Suggestion
  • Other

Details

ClusterWS-Client-JS v3.0.6 not working on v4.0.0.

Connected but not receive on: connect event

Is there ClusterWS-Client-JS compatible with v4.0.0?

Problem with TLS Cert

Submitting

  • Bug
  • Question
  • Suggetion
  • Other

hi, I've a problem when use ClusterWS in secure mode.
I've a NodeJS server with ClusterWS that handle the Ws request and on it I configure my cert but when I try to connect from client I got always this error:
failed: Error during WebSocket handshake: net::ERR_SSL_PROTOCOL_ERROR

raw video/audio access on the server

Submitting

  • Bug
  • Question
  • Suggetion
  • Other

Details

Hi all, I'm thinking of using ClusterWs for a demo app. I was wondering if I can access the raw video data on the server for some extra processing before passing it to the clients?

Disable Log error

Submitting

  • Bug
  • Question
  • Suggetion
  • Other

Please can you add an option to disable the logging into console?

4.0-alpha listen on events from the server

Server

socket.send('myMsg', {
    ID: 123123312,
    message: 'my message'
});

Client

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

//  Not working
socket.on('myMsg', async data => { 
    console.log('data', data);
});

v.4.0.0-alpha Pub/Sub

client.js

        socket = new ClusterWSClient({
            url: 'wss://' + window.location.host,
            autoReconnect: true,
            autoReconnectOptions: {
                attempts: 10,
                minInterval: 10000,
                maxInterval: 100000
            }
        });


        let channel = socket.subscribe('server.log');
        channel.setWatcher((message) => console.log(message));
        channel.publish('any-data-you-want');

        // Nothing in console (((

server.js

//...
const worker = function(){

    const wss = this.wss;
    const server = this.server;

    wss.publish('server.log', 'connected11111');

    wss.on('connection', (socket, req) => {
          wss.publish('server.log', 'try to publish again');
          //....
    });

};

'disconnect' event is not triggered

Submitting

  • Bug
  • Question
  • Suggetion
  • Other

Using:

  1. ClusterWS v3.1.1
  2. OS Ubuntu 18.04

Desc:
'disconnect' event is not triggered after the socket is closed. After I check the disconnect event is missing in the event list in the EventEmitter.

17:20:33.702 emit {error: ƒ, connect: ƒ, response: ƒ, disconnect} connect
17:20:33.718 subscribe to to channel
17:20:33.719 status$: ON
17:20:33.764 emit {error: ƒ, connect: ƒ, response: ƒ} response

I've tried to check if off in the EventEmitter is triggered, but it's not.

a clusterWS-Client-JS implementation for uWebSockets Server

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

Callbacks on socket.emit

Submitting

  • Bug
  • Question
  • Suggetion
  • Other

Details

  1. What version of ClusterWS do you use (you can find it in package.json)
    2.2.1

  2. The operating system you are running on.
    Windows 8.1 64bit

  3. Describe the problem as clear as possible.
    It's simple, actually. I came to clusterWS from socket.io, so, the question is: How to use callbacks on socket.emit ? Whenever I put a third parameter on it (1st: channel, 2nd: data, 3rd... callback?), the server gives an "SyntaxError: Unexpected token u in JSON at position 0" error, which based on other issues, makes me think it's because the 3rd parameter is not supposed to be a callback/function-type.

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.