Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 17 07:47
    jondubois commented #524
  • Feb 17 06:35
    rasoulivand opened #524
  • Feb 15 17:54
    jondubois closed #523
  • Feb 15 17:54
    jondubois commented #523
  • Feb 12 11:52
    jondubois edited #523
  • Feb 12 11:50
    jondubois edited #523
  • Feb 12 11:42
    jondubois edited #523
  • Feb 12 11:42
    jondubois opened #523
  • Feb 07 20:24

    jondubois on master

    v16.0.1 (compare)

  • Feb 07 19:57

    jondubois on master

    v16.0.0 (compare)

  • Feb 04 11:48
    toredash commented #348
  • Feb 03 16:42
    jondubois commented #348
  • Feb 03 16:42
    jondubois commented #348
  • Feb 03 16:42
    jondubois commented #348
  • Feb 03 16:39
    jondubois commented #348
  • Feb 03 08:24
    toredash commented #348
  • Feb 02 17:32

    jondubois on master

    v15.0.6 - Bump scc-broker-client (compare)

  • Jan 20 21:54

    jondubois on master

    v15.0.5 (compare)

  • Jan 20 21:22

    jondubois on master

    v15.0.4 (compare)

  • Jan 20 21:20

    jondubois on master

    v15.0.4 (compare)

go1dfish
@go1dfish
or transition hints from v14 to 15 in general?
hmm seems like with 15 the way to go is to have my worker.js fork itself up to the number of workers desired?
go1dfish
@go1dfish
I'm probably going to wait on the v15 upgrade until it's better documented, so far seems to not offer much beyond additional hassle for my use case
Paul T.
@wilensky
@jondubois I think the case I describe is as follows. authStateChange does work when state changes but in case of socket.setAuthToken({...}) on an authorized connection (aka early JWT extend) auth state is not changed: it was authed and it became authed, but with another token and in this case deauthorization doesn't take place thats why it is not triggerd ... I presume.
hogward1057
@hogward1057
howtogetdb.png
I have a database shared with scc-state, how do I get the database from socketcluster server? Can I have the scc-state server and socketcluster server to subscribe a channel to do this?
Jonathan Gros-Dubois
@jondubois
@/all You can now switch to older versions of the docs on the https://socketcluster.io website. Thanks to @inQonsole for implementing this.
Mateo
@matzero
oh man that is huge... I know I just have to run the old site... but it was such a hassle.
thanks @inQonsole
Kevin Boon
@inQonsole
Not a problem, viewing it in raw form on the GitHub was a struggle for a lot of people, hope this makes things a bit easier and enjoyable for everybody :)
Jonathan Gros-Dubois
@jondubois
@wilensky Ah you mean the socket is authenticated but it authenticates again with new credentials? There is a test case which covers this scenario. Maybe there are some differences from previous SC version. Let me check...
Jonathan Gros-Dubois
@jondubois
@go1dfish there are no migration guides at the moment but most of the integration tests in socketcluster-server and socketcluster-client were re-used between the two versions (with only changes made to match the new API). You can use these tests as documentation; they're categorized by feature.
The API changes are mostly predictable once you get used to the new version.
Jonathan Gros-Dubois
@jondubois
@wilensky Now the authStateChange event only occurs when you the state changes from authenticated to unauthenticated, it doesn't trigger when the token is replaced by a different user. For this, you should listen for the authenticate event which captures authentication changes as well.
Jonathan Gros-Dubois
@jondubois
^ authenticated to unauthenticated or the other way round
Joy
@mandevx
@inQonsole Hi Kevin, Just wanted an opinion about something I need to do and just wondering how to do as best practice and least overhead . So here is what I need to do I need to send a message to user on command line on same machine where I have my socketcluster.io is running or any other other linux machine basically its going to a command line one simple but not best option was i create a shell to run a headless chrome and ( casperjs ) and connect as standard user send message and clean and close instance . But what I am looking a way to connect socket command line may with curl or something and send message but in that case how to manage the client side js of socketcluster .
@inQonsole any suggestion pls, will really appreciate thanks .
@inQonsole curl --include \ --no-buffer \ --header "Connection: Upgrade" \ --header "Upgrade: websocket" \ --header "Host: example.com:80" \ --header "Origin: http://example.com:80" \ --header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \ --header "Sec-WebSocket-Version: 13" \ http://example.com:80/ . ///"
Joy
@mandevx
@inQonsole that is one way but how to pass auth username and password thats what I am confused about and even if this would work or not ?
Kevin Boon
@inQonsole
@mandevx that's a lot of questions, so let start with why do you need to send a message on the command line ?
Jonathan Gros-Dubois
@jondubois
@hogward1057 What do you mean you have a database shared with scc-state? scc-state only knows about other SCC instances (the scc-worker (regular socketcluster) instances and scc-broker instances).
arafasen
@arafasen
HI, i am building mobile application with IONIC using SocketCluster for messaging and geolocation tracking. i am using until now old SC versions. not V15+ (i will test it next project).
Everything is OK. so there is no problem. i am just facing a dilemna.
i want to avoid performance issues both sides (client , server).
my users can be professionnals and if this is the case they broadcast their positions to customer and also to their responsables (1 or more).
i have to scenarios :
  1. client publish to all of them client side. and i am afraid mobile phone will suffer sending realtime geolocation position to many channels for long duration .
  2. client sends to customer and in the server , i create a middleware that intercept messages and relay them to appropriate responsables if necessary.
    so what is for you best scenario that will not create performance issues ?
hogward1057
@hogward1057
I just want to build a generic database that all socketcluster can use. Thanks for the explanation @jondubois
Kevin Boon
@inQonsole
@hogward1057 scc-state should not hold the database, this creates a single point of failure
Kevin Boon
@inQonsole
@arafasen
  1. the client should not send to many channels either a single channel or a relay channel
  2. that really depends on how you want it to work, but in general, the client does not know and should not know anything about other clients it knows the server, the server knows about many, and brokers know about many-more in case of scc, in case you want to send data from 1 channel to another it's better, in my opinion, to let the server (middleware) take care of this, we have successfully used this approach in a game world server where you have multiple regions, chatting on a single world channel, we called them relays, the way we created them was, we create a function called global -> the global function sends the chat to each region channel US-NA-Global-(random_number) pulled from the database, when the channel is full (stored in the database) it creates a new one when somebody leaves the game, it's automatically removed and there is space for another person, this is a very technical approach but this worked create scalling wise and performance wise since channels do not hit performance as much as mutiple sockets connected to a single channel, your approach might be different and your requirements as well, but I hope that helps.
arafasen
@arafasen
@inQonsole
thanks for your answer and i think that i get the point.
middleware on server side was my prefered option but was wondering about performance . so i think i will go in that direction.
Jonathan Gros-Dubois
@jondubois
@hogward1057 The scc-state keeps track of the state of the cluster, you could possibly modify the scc-state code to also track database instances (and other custom types of instances as well). The important thing is to make sure that the scc-state is never a middleman/proxy for data transfers between other components; its only purpose is to see which instances are online and tell that information to the scc-worker instances which are interested (e.g. via the scc-broker-client which is the one which makes the decisions about which broker instances to map different actions to).
You could modify scc-state to track your database instances too and also write a custom scc-db-client (or whatever) which uses the info from scc-state about the database instances to do the mapping.
hogward1057
@hogward1057
ya thanks you @jondubois
Damian Bushong
@damianb
Would there happen to be anything that acts as a server-side graceful shutdown mechanism, along the lines of requesting all clients disconnect themselves, or is that something I'll have to implement myself?
Ingwie Phoenix
@IngwiePhoenix
@damianb I think there is an event you can listen on on the respective worker or broker objects
Otherwise use process.on("exit", f())
kim8823
@kim8823
is there an event on the scc-broker-client when a worker disconnects from the cluster?
sachin shinde
@sacOO7
@inQonsole check my pm
Damian Bushong
@damianb
hmmm... socketClusterServer.attach() doesn't require protocolVersion to be specified, right?
think the new TS definitions might be a little off there
mlmarius
@mlmarius
hi. I want to build an app using vue-cli, to this app I want to add en express server and then on top of that I'd like to add socketcluster
can someone outline what I should do in order to make socketcluster be able to service websocket requests via the express server that my app has ?
Kyle Chisholm
@ChisholmKyle
@damianb I made a new issue for two small new typescript bugs DefinitelyTyped/DefinitelyTyped#42192
Ingwie Phoenix
@IngwiePhoenix
@mlmarius Look at the SocketCluster repo - there should be an example app. And if I am not mistaken, it should also feature express :)
Jonathan Gros-Dubois
@jondubois
@/all I just released SocketCluster v16.0.1; it should be a non-breaking change for most. The goal of this release was to make streams behave a bit more like EventEmitter. v15 was a huge change from v14 so hopefully v16 . If you're using v15, I highly recommend upgrading and also reading https://socketcluster.io/docs/consumers/
Jonathan Gros-Dubois
@jondubois

I'll try to keep improving the documentation related to stream management and consumers (and explain the different types of streams better; listener, receiver, procedure, and channel) because it's quite a different approach for most people and takes a while to adjust to it.

Another comment I received is that the for-await-of approach is quite verbose. The reason it was chosen to return asyncIterable instances instead of supporting async callback registration (EventEmitter style) is that asyncIterable provide the most flexibility - For example, it's possible to pass a stream or Consumer to an async generator function and you can do really interesting things like transform or delay messages in the stream without losing the message order.

Jonathan Gros-Dubois
@jondubois
I made an idea suggestion to TC39 (EMAScript standards committee) about simplified async IIFE syntax; to make for-await-of loops less verbose: https://es.discourse.group/t/syntactic-sugar-for-async-iife/213 - Feel free to comment on that thread to help it get attention.
Dan Delany
@dandelany
thanks and congrats on the release @jondubois ! these types of incremental improvements are def appreciated.
hogward1057
@hogward1057
congratulation. I will wait for a stable version of this fw
Ingwie Phoenix
@IngwiePhoenix
@jondubois Interesting aproach on your suggestion there. Although anything async/await related is prune to be verbose; thats unfortunately the inherent nature. But making async loops more readable would surely be very helpful! So I wish you good luck on that suggestion making passes. It seems to have gathered a few comments so far too.
I gave it a like, gonna keep an eye on it.
kim8823
@kim8823
Hi all, is there any way to get notified when a server leaves the cluster? I need that to notify clients that a server's ressources are no longer available.
Jonathan Gros-Dubois
@jondubois

@hogward1057 Did you find any aspects that you felt were not stable? It would be good to make a list.
This new code had been released for almost a year so it should be relatively stable. Hopefully the SC API will not change from here, but the JS syntax around it might.

I had some interesting discussion on the TC39 forum and it seems there is some interest in adding async capability to the upcoming do { ... } blocks proposal https://github.com/tc39/proposal-do-expressions#examples

I'm hoping the final syntax will look like this:
async do {
  for await (let {socket} of server.listener('connection')) {

    async do {
      for await (let request of socket.procedure('RPC1')) {
        // ... Process the RPC
      }
    }

    await doSomething();

    async do {
      for await (let request of socket.procedure('RPC2')) {
        // ... Process the RPC
      }
    }

  }
}
Ismaeil
@I.Rasoulivand_gitlab

Hey guys,
I want to install scc but when i'm trying to install app stuff with socketcluster create app command, it creates app but app directory doesn't have some files like worker.js and broker.js.
these are what app directory has :

* Dockerfile 
* kubernetes 
* node_modules 
* nodemon.json 
* package-lock.json 
* package.json 
* public
* server.js

so what should I do to solve this problem?
help me plz