How to develop live chat using node js - javascript

I want to develop live chat using node js. Can anyone guide me how to do this? The use cases I decided :
User will see a link or icon on the app screen labeled ‘Online chat support’.
Clicking on this, chat window will open up. Either it will indicate the name of an agent who is online and ready, or it will indicate that agents are busy, and change that status once an agent is available.
On the agent’s side, upto 3 windows (from 3 users) will be opened up before the busy message is generated for further users. This number (3) will be configurable.
The agent will get the name of the screen the user is pinging him from.
Since there will be multiple agents, we need ability to tag a bunch of screens (or apps) to a particular agent.
A load distribution mechanism is required whereby a new query gets routed to any agent who is free, and tagged to that screen or app.
"We need ability to set up an unavailable message for certain time windows –
if chat support is only available say between 9 Am and 6 PM IST, we should be able to set up a message for users who log in outside this window that says ‘Online chat support is only available between….”"
Please advise how to proceed.

You can use socket.io module for creating live chat.
Check this tutorial.

Related

BLE web service disconnects after activity is switched

I am developing a basic web app interfacing the Nordic BLE devkit.
I am new to javascript development and came across a rather common but a weird problem for me while testing my app.
Basically, I have 2 html pages and a common javascript file.
First page finds the nearby BLE devices and connects with it and then stores it's characteristics and services which are needed for the communication. (Processing done in the javascript file)
After a button press on the first html the app runs location.replace("path for second html") and switches the activity to the second html file.
Here I noticed that after transferring to the second page the devkit is disconnected.
I have few buttons on the second page which when pressed invokes routines in the javascript file.
Now since the device is disconnected the characteristics and the services read earlier were lost and the app crashes.
I know this is a typical binding problem but I am quite not familiar with the exact javascript concepts that I need to be looking at in order to have more information for this issue.
Can anyone help me with this?
It is not currently possible to transfer a BluetoothDevice or any of the other associated objects to a new page during a navigation (which is what happens when you call location.replace()). If possible you should keep the user on the same page for the entire time that it is connected to a device.
There is upcoming work on Chromium issue 974879 which will make it possible to keep the permission the user granted your site to connect to the device across navigations and sessions but you will still have to reconnect on each page.

How to set the microphone ask(default) for all the time in getUserMedia()?

I'm working on a project which is kind of speech-to-text. It has only a microphone option. Whatever you speak, it reads the input and shows you the converted text in the text area.
What I want is whenever I click on the stop button, it should turn off the permission allow to ask(default). Because it will only ask for the first time in https. So, how can we make it ask for permission all the time?
In HTTP it will ask all the time. Likewise, I want the same for https as well.
Please help.
I'm tired searching that piece of code which could do the job.
Thanks in advance.
Edited
navigator.permissions.query({name:'microphone'}).then(function(result){
if(result.state=="granted"){
result.state="prompt"
}
});
Can I manipulate the permission states of browser like changing from granted to prompt?
navigator.permissions.revoke('microphone') might work. But, unfortunately the revoke() method is deprecated.
So, you would be wise not to rely on this requirement in your app.
On iOS Safari, it does ask every time.
Normally, this is not your job. This is controlled by client setting. When user starting the app(web app also), system will check the permission for camera/microphone/contact etc. User will decide if ask him to grant every time. For yours, if running in browser, system will check the browser permission, NOT YOUR WEB APP. If other web require the microphone permission first, when starting your app, normally no need to ask again. Also, your app revoke the microphone will disable other web app also. It is not correct!

Is it possible to install a PWA precached with server's data?

Let me give you an example of the flow I am trying to achieve:
A user enters the website
The user has everything loaded (both files and network requests)
Files are now cached due to fetch event listener
The user installs the app on their phone (so far everything works as expected)
All the data that has already been fetched by the user is transferred to the app so that the user could launch the app in offline mode.
Currently, the last step is not working. User must open the app at least once whilst online in order to make it work. Is it possible to "transfer" the website's cache to the app? If so, could you nudge me in the right direction with some helpful links? Thanks!

Opening a program via a web browser

Recently I've been working on a project which allows users to replay their old league of legends games, currently I record the files to my server and the user is required to run league of legends with some params (my server, ip, the games encryption key, the games id and the server id).
I can ask all my users to do this manually or using a batch file which I can serve them but I'd be interested in seeing if I could do this via a browser button click.
I had the idea from battlefield hardlines web based browser however figured that was done via an install (I'd rather not force users to install anything) and my second thought was magnet urls (however reading up on magnet urls I don't think I could use them)
Is this at all possible or is there some other way I can make this system more user friendly?
Thanks!
You can't. The browser runs in a sandbox that forbids that sort of system access.
Having said that you can do it with ActiveX (in IE only) but it requires all sorts of permission hacks and is just not a good idea!

How can I manage video conferencing "allow" requirements from browsers?

I have a rails app with JS and am using TokBox api for peer to peer video conferencing. When a user first signs into the video conferencing they are prompted by the web browser by the following prompt
"COULD NOT ADD IMAGE DUE TO REPUTATION" - The first prompt is at the top of the browser and says "example.com wants to use your camera and microphone allow--deny"
That only happens the first time they visit the site. They are then prompted by the next allow request. This second allow request happens every connection while the first prompt is only for the first connection.
"COULD NOT ADD IMAGE DUE TO REPUTATION" - The second prompt is at the space where the users own video will be viewed and says "camera nad micrphone access, example.com is requesting to access your camera and microphone. If you click allow, you may be recorded"
How can I tell if the user allows or declines either of the prompts? I would like to walk my user through the prompts but am having trouble identifying if they click allow or decline and am having trouble knowing if the first prompt is triggered or not (unless I just track their site visits).
Thanks!
PS any help with reputation would be much appreciated, the pictures make the question much clearer.
You can add event listeners to Publisher object to listen to accessAllowed/Denied events that will be fired when the user clicks on allow or deny: http://tokbox.com/opentok/libraries/client/js/reference/Publisher.html#events

Categories