Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 25 2020 20:53
    jondubois opened #537
  • Dec 23 2020 18:50
    loxy closed #536
  • Dec 23 2020 18:50
    loxy commented #536
  • Dec 22 2020 15:38
    jondubois commented #536
  • Dec 22 2020 15:35
    jondubois commented #536
  • Dec 22 2020 15:31

    jondubois on v16.0.1

    (compare)

  • Dec 22 2020 10:22
    loxy opened #536
  • Dec 11 2020 07:12
    ahmetbozdoan commented #528
  • Nov 03 2020 05:49
    pentestusa commented #524
  • Oct 30 2020 05:55
    pentestusa commented #524
  • Sep 01 2020 10:47
    JojoStacy commented #429
  • Aug 14 2020 17:36
    SeedyROM closed #535
  • Aug 10 2020 16:14
    SeedyROM commented #535
  • Aug 07 2020 21:02
    SeedyROM commented #535
  • Aug 07 2020 13:31
    jondubois commented #535
  • Aug 07 2020 13:30
    jondubois commented #535
  • Aug 07 2020 13:30
    jondubois commented #535
  • Aug 07 2020 13:29
    jondubois commented #535
  • Aug 06 2020 18:16
    SeedyROM opened #535
  • Jul 20 2020 13:43

    dependabot[bot] on npm_and_yarn

    (compare)

Paul
@wilensky

@jondubois Thanks. I was looking at how scc-broker-client is organized. Probably infrastructure I have at hand is not too SCC friendly ) but even if we will take into account the case when scc-state is down for some time for some random reason and than it gets back online (cluster is operative and should self-recover) - I can't reconnect to it using same hostname (in my case).

Here is the flow:

  1. Server is starting (cluster mode presumed)
  2. Obtaining DNS SRV record of scc-state service
    • Received smth. like 123xxxZZZ.scc-state.local
  3. Passing hostname to scc-broker-client.attach()
  4. ... working ...

Than we have this sporadic failure and scc-state restarts.

Server tries to reconnect to 123xxxZZZ.scc-state.localusing its strategy but hostname is changed bec. old container is down and new one is up and DNS SRV has another hostname for scc-state. And this reconnect strategy (which is used in brokers as well) is kinda not applicable for such envs as it requires hostnames to be static what nicely fits in k8s, but not always true for other envs.

Jonathan Gros-Dubois
@jondubois
@wilensky One solution would be to figure out a way to assign a fixed hostname to always point to the latest scc-state IP address (maybe a service like Consul). Or you could customize scc-broker-client to add a dettach method somewhere - Then when scc-server restarts, you would dettach the old client and attach a new one with the new IP on all the scc-worker and scc-broker instances.
If your company is willing to sponsor me, I could try to make some time to implement this dettach feature. It shouldn't be too difficult though.
jkishor
@jkishor
Hi guys I am new here and new to socketcluster.io . I have inherited a existing project on socketcluster I read documentation but still confused would appreciate some help and direction about how and where ?
Using SCC broker in project, what I know project was upgraded to SCC from old Socketcluster so there was then redis in use for pubsub to cluster multiple socket cluster servers , but I think SCC itself handles the clustering so I need to understand what is the right way to know if version I am using supports clustering natively and how can I run two instance to try clustering as well to remove the existing redis pub/sub.
Paul
@wilensky

@jondubois Super! Thanks! We will definitely discuss the way to handle this out. I was thinking on patching scc-broker-client but also thinking on evading DNS SRV as it bring more pain than gain since its there TBH. I'm also thinking on attempting to move to k8s as long there is not that much stuff to migrate yet.

We attempted to imply AWS ALB and NLB, but due to NLB nature it doesn't allow loopback connections, couldn't finish ALB configuration bec. it was translating it's own IP to scc-state but not server/broker ones, so it was not possible to connect back, there is a possible option with X-Fordwarded-For but didn't try it yet. So we are working on adapting AWS to SCC and back ))

jkishor
@jkishor
I am configuring scc-state with multiple hosts, I am not able to figure out where to tell scc about multiple hosts, as to run broker and server SCC_STATE_SERVER_HOST is used but how different scc-state on different hosts will share pub/sub channels with each other ?
Joy
@bnkcrypt

Hi, I am looking to run two SCC servers on two HW machines . what I am looking for some guidance as the document does not clearly tell how would cluster know ips of each other in this case different machine the example in doc illustrates with same ip and different ports but still i wonder where is the confof for each servers to tell about other servers for making sure servers manage the pub/sub part to delivery message to users spilt between two machines https://github.com/SocketCluster/socketcluster/blob/master/scc-guide.md

my I would like to know how to define ips is there a way to run scc-state on private ips and actual servers on public ips

Kevin Boon
@SloppyShovel
@bnkcrypt yes, we run scc-state on an internal ip that's not a issue, the only part that needs public access is where the client connects to that is scc-server, you can specify the scc-state ip using the var
SCC_STATE_SERVER_HOST='127.0.0.1'
Kevin Boon
@SloppyShovel
as long as the scc-cluster can reach each required part internal or external it don't really matter it's up to you to configure your internal network, scc-state should not be exposed publicly if you can avoid having your brokers exposed to the public as well great, one way we fixed it is using a private internal vpn it's able to communicate with servers in EU and USA, as long as scc can find it you be oke, what you need to avoid is talking to internal end points from external that's going to cause issues, hope that helps.
Chirag Chhuchha
@chirag4396
Hello guys, I'm new to JS world and also for socketCluster ;) and I'm trying to use NestJS and socketCluster together and I also managed to run both together but now I'm stuck at one point where I'm trying to get the AGServer instance inside the service file (also tried on controllers) of NestJS module but didn't succeed. so anyone can guide me through this issue? how to fix that? or Is there any specific guide which illustrate about the socketCluster usage with NestJS?
Kevin Boon
@SloppyShovel
@chirag4396 uhmm if you are new then a complicated framework as NestJS might not be a good start that being said, you would need to create a nestjs module and inject the socketcluster into it, it becomes a interface to bridge nestjs and socketcluster, when you do that i becomes a gateway and you can talk to it in nestjs, a better option would be to ask advice at a nestjs community.
you can find a write uphere what you can use as a example : https://gabrieltanner.org/blog/nestjs-realtime-chat
Soroush
@soroushm
Screen Shot 2021-01-19 at 20.02.11.png
Hi Guys,
I discover performance issue on both of application (mobile and desktop) when we subscribe a lot of channel around (400) each one have 10 push on the second then cpu usage grow up to 100% and crashing
Kevin Boon
@SloppyShovel
Performance issues are on server side or on client side ? @soroushm
Joy
@bnkcrypt
Is there a method to create logs I would like to create logs for user auth and connections to further use it with applications like fail2ban
Kevin Boon
@SloppyShovel
@bnkcrypt as in create logs i understand creating log files, that's not really in the scope of what socketcluster is, you can use any logging framework you want, or use default console.log method to log to the console .
Soroush
@soroushm

Performance issues are on server side or on client side ? @soroushm

Yeah it's in a client-side

jkishor
@jkishor

@SloppyShovel I am publishing message with acknowledgment method but even if publishing a message to non-subscribed channel it is not giving any error. I am using following

(async () => {
    try {
        // Publish data; wait for an acknowledgement from the server.
        await socket.invokePublish('foo', 'This is some more data');
    } catch (error) {
        // ... Handle potential error if server does not acknowledge before timeout.
    }
})();

Do I need to do handle it on server side or need to do something at client side.

Kevin Boon
@SloppyShovel

Performance issues are on server side or on client side ? @soroushm

Yeah it's in a client-side

Oke and what client are you using ?

jkishor
@jkishor
@SloppyShovel I am rephrasing my question, what I am trying to do is sending/publishing a message to non subscribed/non existing channel hoping to get an error but I get no response at all I was hoping such would end up in error case where I intend to handle and manage undelivered messages with my own logic . what is needed so that such would end up as an error if non channel exists to message was sent.
Kevin Boon
@SloppyShovel
@jkishor Oke but the error you get is on acknowledgment, if you don't get an error means the server received it, what you are trying to do is get an error when the client sends a message to an unsubscribed channel
that's 2 different things, it's generally not a good idea to based your channel delivery status on a subscribed and unsubscribed bases, because socketcluster has a build in feature that put the channel in pending mode on a network issue, and places the messages send in a buffer, you might not get the expected result using it that way, if you don't want people to send messages to an unsubscribed channel you should use middleware using an authentication logic.
jkishor
@jkishor
@SloppyShovel I am trying to do is if message is not sent to the channel, then I can do my logic for undelivered messages
Kevin Boon
@SloppyShovel
there is a example on how to achieve that in the documentation, https://socketcluster.io/docs/authentication/
oke but thats what you have in here.
(async () => {
    try {
        // Publish data; wait for an acknowledgement from the server.
        await socket.invokePublish('foo', 'This is some more data');
    } catch (error) {
        // ... Handle potential error if server does not acknowledge before timeout.
// here is your logic when a message is not delivered <-------
    }
})();
jkishor
@jkishor
Is there a method from Client side, I can get status of any Channel is subscribed or unsubscribed ?
Joy
@bnkcrypt
@SloppyShovel I am trying to figure out a way where I can create a hook to understand message received by servers from client user A to User B's channel has reached the channel successfully or failed if failed I would like to add my call to send push notification to mobile device . I could not find such api and i understand such functionality is not exposed though api yet . so could you please guide where and which part of the architecture and file I can look for such functionality where servers gets to know state of message published to channel was a success of a failure ?
Kevin Boon
@SloppyShovel

Is there a method from Client side, I can get status of any Channel is subscribed or unsubscribed ?

Yes, it's in the documentation

isSubscribed(channelName, [includePending])

@SloppyShovel I am trying to figure out a way where I can create a hook to understand message received by servers from client user A to User B's channel has reached the channel successfully or failed if failed I would like to add my call to send push notification to mobile device . I could not find such api and i understand such functionality is not exposed though api yet . so could you please guide where and which part of the architecture and file I can look for such functionality where servers gets to know state of message published to channel was a success of a failure ?

Oke, but define reached to channel, when each client is it's own channel the message delivery is guaranteed as long as the client is connected, from where do you wanne send the push notification from client side or server side, and from which user to which user you want to send it, lets say client a sends a message to client b, client b didn't read it, you want to send a push notification to client b ?

jkishor
@jkishor

Is there a method from Client side, I can get status of any Channel is subscribed or unsubscribed ?

Yes, it's in the documentation

isSubscribed(channelName, [includePending])

I tried isSubscribed from client side by giving a channelName it return me false always... I tried both together invokePublish and isSubscribed for same channel, my message was received by channel but isSubscribed returned me false

Kevin Boon
@SloppyShovel

Is there a method from Client side, I can get status of any Channel is subscribed or unsubscribed ?

Yes, it's in the documentation

isSubscribed(channelName, [includePending])

I tried isSubscribed from client side by giving a channelName it return me false always... I tried both together invokePublish and isSubscribed for same channel, my message was received by channel but isSubscribed returned me false

Did you subscribe to the channel ?

invokePublish is not going to do anything, just going to publish a message you send, isSubscribed is going to be false ofcourse until you subscribe to a channel.
subscribe is receiving messages in real time, not sending messages, the server controls everything at all times, if you send a messages and you don't do anything on the server side, its going to let the message pass and send it to everybody that is subscribed to the channel where you published the message.
jkishor
@jkishor
I have 2 users, user A is subscribed to channel CA and user B is subscribed to CB, both users are on same host but different devices. Now from A I want to know if channel CB is subscribed or not. I tried isSubscribed by giving channelName=CB, it given me False.
Kevin Boon
@SloppyShovel
what you are doing is, asking, is user A subscribed to channel CB
of course its going to be false
because the user ain't subscribed to that channel
user A does not know anything about channel CB or user B
that's not how that works
jkishor
@jkishor
Is there any support for offline messages if the user is not connected ? I found this https://github.com/SocketCluster/sc-crud-rethink but its using worker.js, so I guess it doesn't support in current version
Kevin Boon
@SloppyShovel
that has nothing to do with offline messages
there is a writeup made by the creator of socketcluster you can do a quick good search and then you will found this : https://jonathangrosdubois.medium.com/if-a-client-is-offline-they-will-not-receive-the-message-221627d423fe
Soroush
@soroushm

Performance issues are on server side or on client side ? @soroushm

Yeah it's in a client-side

Oke and what client are you using ?

"socketcluster-client": "^16.0.1",

Chirag Chhuchha
@chirag4396

@chirag4396 uhmm if you are new then a complicated framework as NestJS might not be a good start that being said, you would need to create a nestjs module and inject the socketcluster into it, it becomes a interface to bridge nestjs and socketcluster, when you do that i becomes a gateway and you can talk to it in nestjs, a better option would be to ask advice at a nestjs community.

@SloppyShovel thanks for the suggestion actually after posting my query here I was still looking for some sort of solution and while doing that I get to know that NestJS is providing a gateway facility through which one can create a custom gateway/adapter so I started working on that already. Thanks again for the help :)

Kevin Boon
@SloppyShovel

Performance issues are on server side or on client side ? @soroushm

Yeah it's in a client-side

Oke and what client are you using ?

"socketcluster-client": "^16.0.1",

i have never seen that, might have to go over your code and see what its doing

Soroush
@soroushm

Performance issues are on server side or on client side ? @soroushm

Yeah it's in a client-side

Oke and what client are you using ?

"socketcluster-client": "^16.0.1",

i have never seen that, might have to go over your code and see what its doing

let me create simple code and remove extra part then seen what happend

SamJakob
@SamJakob
Hi, I'm working on Dart and Flutter implementations of SocketCluster. Released under MIT License, contributions/forks/derivatives are welcome.
(dart)
https://pub.dev/packages/croupier
https://github.com/SamJakob/croupier
(flutter wrapper to be released shortly)