How to detect disconnect event on a channel with Faye - ruby-on-rails

I am trying to make a chat on my website looking like google talk. I
want to manage the disconnect event. A user can disconnect on several
way :
By clicking the disconnect button (easy to push the event to his
friends)
By close his windows (I can send the event to windows close
javascript event but if the user has many windows open on my website,
i don't want to disconnect him.)
So, how can i detect when my connection on a channel is closed? Each
user has his own channel build with his id.
Thank you for help.

You can check out the meta events, /meta/unsubscribe and /meta/disconnect.
More info here: Faye Monitoring

Related

Phoenix channels, How I kick a user from a channel?

So I am trying to understand the workflow in kicking a user from a channel. I have a command I can issue to the channel #kick username. This is handle by a handle in which parse the message and will detect is a command. That will call the kick function in my channel. My issue is how I actually make the user leave. There is no such thing as Endpoint.Broadcast with a leave event like we have for disconnecting a socket from everything.
I've been told to use a Endpoint.Broadcast an event like kick and use a handle_out to intercept it. Well even if I use it, how is this disconnecting the user I want specifically to be kick as an admin.

iot gprs sends event to ggogle assistant and triggers a pushed intent to initiate a full dialog -> general guidance

A gprs initiated event from an IOT device shall invoke a dialog on google assistant without the users having to start the dialog themselves. IOW. the begin of the dialog is externally triggered by an event and this event and not the user starts a dialog. Can this be done?
I am a NodeJs convert from one of the two other dialog management systems and know how to write a dialog and have limited know-how on google assistant to react to events.
There is an IOT device that sends GPRS messages to a google assistant device in case of a status change. This should trigger a push event on the assistant's host device which speaks a message about the event and allows the recipient to control further actions through a predefined dialog.
An 'alarm' on 'google home' fulfills the first requirement: Not the user but an external event (timer) triggers the dialog without there being a permanent connection during the timer countdown.
This alarm, however, does not seem to be a dialog as it only allows to 'stop' it.
As far as I found does it seem hard -and was impossible some time ago- to barge into a device without prior activation by a user. I do not know if it is possible to emulate a user request action to initiate a dialog or if there are better ways to push an event to initiate an intent that starts -without having been activated by the user- a dialog. (Those dialogs are approved and expected by the user)

Call disconnect if app is terminated

I use Twilio API to create video between two users. It works good if one of the users clicks on "Disconnect". But when user terminates his app, the picture "freezes". How can I disconnect user if he terminates his app (turns off internet connection, ...) ?
Twilio developer evangelist here.
I would implement the TVIRoomDelegate methods didDisconnectWithError and participantDidDisconnect so that you can clear up video connections when a disconnection is detected.

Sending events between participants on an active twilio video call

We are experimenting with the Twilio video call SDK for iOS and we are able to establish a call between two users but now we would like to send events from one user to another. For example, one user would tap a button on his device and the event would be sent to the other device to display a sound or animation. Basically we are looking for a way to establish a data channel between both callers that we can use to send events, much like a websocket.
Thanks for your input! Regards,
Enrique
Twilio recently announced a State Syncronisation API which you can use to solve your problem , have a look : https://www.twilio.com/sync
For your case, you could setup up a "Map" item ( a map of event to device identity ) on Twilio sync which could be used by a device to push their events to Cloud to which any subscribed devices can get the info pushed to .

Keeping iOS socket alive in background mode without VOIP

We have an game that creates a player lobby using sockets. When the player creates a lobby, a game is created on our server. Unfortunately if the user switches our app away with the Apple button, another user may join the game and the game will start with just one player active. So we want to send a message to our server via a socket when the app transitions to the background to close the lobby, stopping others joining.
But we can't. The sockets get frozen on entering background mode. Even if we keep the app alive a while using beginBackgroundTaskWithExpirationHandler, no socket activity works.
VOIP is not an option, as the title is not VOIP related and will get bounced immediately from Apple submission.
Any one got any non-VOIP related ideas?
Many thanks,
Steve.
I think what you want to do is to let the server know that this user is off-line when touching the Apple Home button.
I am using GCDAsyncSocket, but other ways may be similar.
What I'm doing is
Add observer on UIApplicationDidEnterBackgroundNotification.
When application enter background then call socket disconnect. The server will know that you are off-line.
I know this is a little late for your answer, but could be helpful for others.

Resources