Hello Freswitch Geeks,
I am facing some challenge handling events with the mode event_socket. I create a socket library that implements some of the features of the mod_event_socket in-built ESL. This what I did: I connect to Freeswitch, subscribe to events via events command and execute an originate command using the socket application. When the call is answered FS connects back to a daemon app runnning and based upon this guideline https://wiki.freeswitch.org/wiki/Event_Socket_Outbound#Using_Netcat I am able to handle the call.
However the issue I am facing is some of the events are not received by the deamon app(for instance channel_hangup_complete, record_stop...) I would like to know whether I am missing something.
Thanks
from the link you posted
it's a race,
sometimes the socket connection ends before the channel
the linger socket command was added to tell FS to wait for the last
channel event before ending the connection
just send the command
linger
This is an api command, so you will need to run "api linger" or something similar
Related
I have a Sails app and several Sails Shell scripts run by cron or other external triggers (mostly me typing in the shell). I would like to implement notifications in the browser via builtin Sails socket client, which works but only when sails.sockets.broadcast() is called from a Sails Controller, that is, I was able to run the example from the docs.
I can't succeed to broadcast a message from a shell script or even from sails console --dontLift, it seems that the registered clients are only on the socket that is running on the server and the shell/console instantiates another socket... makes sense but isn't possible to get those clients?
Is there any solution to broadcast a message from a Sails shell script to registered browser clients?
Furthermore, can I use Sails socket in a service worker to create push notifications? I understand that socket.io is different from Push, but is somehow feasible?
update
Thanks to #nahanil for pointing to redis, I found this article in the docs Realtime communication in a multi-server (aka "clustered") environment
Thanks!
Luca
I have setup an Indy IdFTP Client to a FileZilla FTP Server.The client tries to Connect on startup of my app and, If it fails, keeps retrying every few seconds for the lifetime of the app. In addition, I need to detect if I lose the connection and, again, keep trying to re-establish the connection. This is where I am having a problem.
I have added an OnStatus event handler which seems to fire for all the event types except hsDisconnecting and hsDisconnected.
I also have an OnDisconnected event handler which only fires when I have locked the Server, in this case, when I try to connect, it fires the OnConnected then immediately fires the OnDisconnected. However, if I set the Server as not Active after the initial successful connection, the server tells me it has disconnected me but I do not get an event in my code so I don't know I need to start trying to connect again? Am I wrong in expecting these events in this scenario, is there something else I should be listening for?
Thank you in advance for your help.
I'm trying to create a fairly simple WebSocket server using Netty 4.0.8. I have the basic handshake set up and working. But messages sent from a separate thread don't seem to be coming through to the client.
The way the client/server interaction works is that the client initiates the connection and then sends an initial message ("hello") over the WebSocket. The server responds immediately. This message comes through and is visible in the Chrome Dev Tools. After this message is written, I store the Channel in a ChannelGroup. This ChannelGroup is initialized like this:
this.broadcastGroup = new NioEventLoopGroup();
this.group = new DefaultChannelGroup("websocket", broadcastGroup.next());
and then the Channel is added like this:
group.add(ctx.channel());
In a separate thread (created outside of Netty), I do:
group.write(new TextWebSocketFrame("text"));
However, this message never appears in the Chrome Dev Tools.
I've tried debugging and I can see that when group.write() is called, the original Channel is in the group, but that's as far as I can get.
Check the ChannelFuture that was returned.. Most likely the ChannelFuture for the write was failed. Maybe you wrote it before the handshake was complete ?
Nevermind. Turns out the issue was that I neglected to call group.flush()
I'm writing a chat server application where the users can exchange messages with one of his friends. When the user connects i store his connection on an class variable hash:
##connections[:user_id] = conn
When someone sends the user a message, I look for his connection on the hash and send the message through it. Sometimes the connection whith the clients simply dies, and the onclose callback is not invoked.
That works fine, and it's what I did when I started writing a web IRC client, but the problem is you're coupling your connected users to a single ruby process. If you wanted to spin up a 2nd em reactor, that 2nd process would not share the same class variables. You can get around that by using haproxy to split users between the different processes, but it's something to watch out for.
I'm trying to efficiently implement comet-like functionality using HTTPServer class of boost::pion.
Basically, in my 'handleURI' function, I would like to postpone returning results to the client, until the server is ready to respond (for instance, until another user has sent a message to the first user, to use a simple comet 'hello world' application).
What should I do? Put the state on the stack, and exit silently, without creating a HTTPResponseWriter?
Cheers!
Setup a timeout ASIO event for your connection so that you can reap the connection after 20min or something reasonable like that. I don't know about Boost Pion, but in ASIO you'd want to register a read handler that catches when the connection closes and a timeout handler to alert you for when the connection has actually timed out. Enable TCP keep alives on your socket to detect when the socket should be reaped in the event that it just vanishes (though tcp keep alives aren't a guarantee so don't rely exclusively on them - not all clients support tcp keep alives). As for the timer, check out the following timer example:
https://github.com/sean-/Boost.Examples/blob/master/asio/timer/timer.cc