jondubois on v16.0.1
dependabot[bot] on npm_and_yarn
@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:
scc-state
service123xxxZZZ.scc-state.local
scc-broker-client.attach()
Than we have this sporadic failure and scc-state
restarts.
Server tries to reconnect to 123xxxZZZ.scc-state.local
using 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.
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.
@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 ))
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
@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.
(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 <-------
}
})();
@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 ?
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
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 ?
@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 :)
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