When does Pubnub Debug Console user Console_Admin unsubscribe/exit test channel? - pubnub

I am learning PubNub and building real time applications with PubNub
PubNub's new debug console allows me to connect several test clients to a channel of my choice - this is cool!
I notice that the debug console has a user named "Console_Admin" that subscribes to the channel. This user stays on the channel even when all test clients have unsubscribed and exited. This user appears to stay even when a new session is started with the Debug console.
I know this since I have another client running on my local machine that is listening to Presence events on the same channel. And the Console_Admin user has not left the channel, despite me having started a "New Session" on the Debug console
Does "Console_Admin" ever unsubscribe from the test channel? Is there a way I can have it unsubscribe?

It appears that eventually the "Console_Admin" user does unsubscribe from the channel
After a while when I logged back on the channel from my local NodeJS client, the occupancy was down to 1 (indicating my local NodeJS client was the only one around)
The new PubNub Debug Console probably has some sort of 'lazy unsubscribe' for the Console_Admin users

Related

Show user status(online or offline) in my app

I have an education app that written by node.js and express.js
I want to show user status(online or offline) side profile photo
How can do it???
Using socket.io is a good choice here: https://socket.io.
Once a user logs in successfully, you can emit an event to broadcast to everybody else that he is online. Similarly, when the user logs out, you can emit another event to broadcast to everybody else that he went offline. (Also when he closes the browser without logging out properly).
Using socketio you can emit and listen to events between the client and the server. You can broadcast events to multiple clients, you can add clients to rooms and broadcast events specifically to the clients in the room, and do a whole lot of things!
Good luck.

How to check if the user has the webchat window open?

I am creating a customer support bot using Ms botframework v4 with nodeJS and directline API 3.0. A customer would talk to the bot and on request, the conversation would be handed over to an agent. If the customer requested to talk to a bot, the customer will wait until the agent becomes available. I want to check if the customer is still active before the agent sends a message to him/her.
wireframe of the bot and the webiste As you can see in the image Jack is in the queue I want to find out a way to check if Jack is still waiting, or he close the window and no longer waiting.
Check out this SO solution I provided. The request is similar to yours in that the OP wants to know how the bot can be notified if a user exits.
The short answer is to use an event listener. Before the window (that houses the web chat instance) is closed, an event is fired. This event is picked up by web chat which sends an activity (message, event, or other) to notify that bot.
From this point, you simply need to forward the notification to the agent that the user has exited the conversation.
Hope of help!

TokBox one-to-one Text & Video Chat - Android

As per our client need in mobile application the Publisher needs to initiate the session and show the text chat first and same as when a Subscriber joins the session, he starts with the text chat. If the subscriber wants to start & join video chat, he can ask the publisher and starts the video chat once publisher accepts & started.
Now the issue is if the Publisher initiates the session & press home button. App does not gets internet service, due to this the session disconnects after few auto reconnecting try outs.
So we planned to re-initiate the same session with same session id & token, once the Publisher resumes the app.
In this latest sample app (https://github.com/opentok/accelerator-sample-apps-android) we could not able to re-initiate the session. But in the previous example with the following package compile 'com.opentok.android:accelerator-pack:+' we can achieve connecting to session, But the text chat session is not connecting.
Please guide me. Thanks in advance.
Push HOME button should not cut internet connection. Actually, normal behaviour is to keep audio streaming so you have to mute it on onPause()
If you are suffering disconnections for any reason and you can't solve it, you should not try to reuse a session. It is recommended to create a new one.

How to send message after user's socket disconnect from the server

I'm using net module of node.js to build a chat server based on TCP. I have figured out how to handle the situation where two users both connect to the server. However, for a chat app, even if the user disconnect from the internet, people can still send message to those disconnected users. I just have no idea of how to achieve this.
You need to save messages in a database so that when they log in again you can retrieve sent messages and send them all at once.
There is no way to communicate to a user who has logged off. You just have to queue up the messages and deliver them when they reconnect.

Using socket.io for notifications and chat

I'm very new to node.js and sokcet.io that's why I need to ask you about the plan I have to see if it makes sense or is plain stupid. I need ongoing server/client communication for two reasons: sending real-time notifications to the user when they have one, and two, for chat between users.
Here is my plan for managing notifications:
PHP script finds out user X has a new notification.
Using Elephant.io send a message to server with user X's id as the data.
On the server side, upon receiving the message, if user X is connected emit him a message telling they have a notification.
user X's brower, Upon recieving the message, uses AJAX to poll the database and receive the text for the notification.
For chat, this is my plan (messages should be save on DB):
When user X submits a chat message to user Y, use ajax to send the text to a PHP script and save it on DB. On success, use elephant.io to send a message to user Y telling them that they have a new chat message.
User Y's browser, after receiving the server message, uses AJAX to poll a php script to receive the new text.
Do you think these plans are superior to short polling using AJAX? I appreciate any comments to improve them.
Finally,I'm curious to know how reliable these technologies (node.js, socket.io, elephant.io) are. Do they work well when the server becomes busy? How do they handle exceptions and errors ,etc.

Resources