Conversation.js runs top over RTCMultiConnection.js
Conversation.js is inspired by skype; and it provides simple events-like API to manage conversations, enable/disable media devices; add/download files; and do anything supported by Skype.
It allows you open data conversation between two or more users using their user-ids.
It is MIT Licenced, which means that you can use it in any commercial/non-commercial product, free of cost.
npm install conversationjs
To use it:
<script src="./node_modules/conversationjs/conversation.js"></script>
Demos using Conversation.js
- AndroidRTC
<li>
<a href="https://www.webrtc-experiment.com/Conversationjs/search-user.html">Search Users</a>
</li>
<li>
<a href="https://www.webrtc-experiment.com/Conversationjs/cross-language-chat.html">Cross-Language (Multi-Lingual) Text Chat</a>
</li>
<li>
<a href="https://www.rtcmulticonnection.org/conversationjs/demos/">Old Conversation.js demos</a>
</li>
Gif Presentation
Link the library
=
Open simple conversation between two users
var websocket = 'ws://domain:port/'; // initializing constructorvar signaler = ; // whatever sent from conversation.jssignaler; // your websocket listener that subscribes// for all messages broadcasted from WebSockets connectionwebsocket { var message = JSON; // here, you received a message from websocket server // pass message to conversation.js signaler;}); var user = ; // connect user to signalersignaler; // invoke this method to open conversation with any useruser; // this event is fired when conversation is openeduser;
How to use socket.io?
var socket = io; // initializing constructorvar signaler = ; // whatever sent from conversation.jssignaler; // your socket.io listener that subscribes// for all messages broadcasted from Node.jssocket; // connect user to signalersignaler;
How to use WebSockets?
var websocket = 'ws://domain:port/'; // initializing constructorvar signaler = ; // whatever sent from conversation.jssignaler; // your websocket listener that subscribes// for all messages broadcasted from WebSockets connectionwebsocket { var message = JSON; // here, you received a message from websocket server // pass message to conversation.js signaler;}); // connect user to signalersignaler;
How to set defaults?
"defaults" are default properties, objects and methods that are applied to RTCMultiConnection object.
See list of all such properties here: http://www.rtcmulticonnection.org/docs/
userdefaults = log: true // for production use only. trickleIce: true // for SIP/XMPP and XHR getExternalIceServers: false // ice-servers from xirsys.com leaveOnPageUnload: true iceServers: url: 'stun:stun.l.google.com:19302' iceProtocols: tcp: true udp: true candidates: host: true // local/host candidates reflexive: true // STUN candidates relay: true // TURN candidates autoReDialOnFailure: false // renegotiation will not work if it is true body: documentbody || documentdocumentElement;
How to accept/reject friend requests?
user;
How to check friend-request status?
user;
How to emit events to multiple users?
document { userpeers;}; document { userpeers;}; document { userpeers;}; document { userpeers;};
How to share files?
document { userpeers;};
How to check if target user added file?
conversation;
How to check file-download progress?
conversation;
How to save downloaded file to disk?
conversation;
How to check if file is successfully sent?
conversation;
How to check if target user refused to receive your file?
conversation;
Demos
Credits
- Personal Webpage: http://www.muazkhan.com
- Email: muazkh@gmail.com
- Twitter: https://twitter.com/muazkh and https://twitter.com/WebRTCWeb
- Google+: https://plus.google.com/+WebRTC-Experiment
- Facebook: https://www.facebook.com/WebRTC
License
Conversation.js is released under MIT licence . Copyright (c) Muaz Khan.