0

I've read a lot of documents about webRTC. Now I want to implement a sample application. I went through this useful stack overflow question.

And I got some client, a server in Javascript. I don't know how to start to see this demo . What are the steps should I take?

They explained like :

signaling technology: WebSockets
client: pure html/javascript
server: node.js, ws
last tested on: Firefox 40.0.2, Chrome 44.0.2403.157 m, Opera 31.0.1889.174

I understand this but I don't have much practical knowledge on this. These are my questions to setup this demo ?

  • Should I have a hosting account ? or can I use this with my localhost ?
  • Next , where should I done this node.js, ws ? can I use with linux machine and install npm and run the server.js file on that ?
  • How can I start client.js code on my Linux machine ?
  • Only server.js and client.js file is required to setup this application ?
svarog
  • 9,477
  • 4
  • 61
  • 77
user2986042
  • 1,098
  • 2
  • 16
  • 37

1 Answers1

2

I am new with WebRTC too, but i hope my answer can satisfy you

  1. You can use that demo in localhost
  2. You can install nodejs in linux machine and run server.js on that.
  3. To run the demo
    • run server.js through nodejs. Make sure you installed ws package first.
    • then you create a directory name static and put client-side code in there.
    • open your browser and go to localhost:80 to see the demo.
  4. Yes, you just need 2 files to setup that application. The client file in Working Hello World WebRTC DataChannel Examples with Signaling Implemented is a html file not javascript.

You can see another tutorial in here: http://www.tutorialspoint.com/webrtc/webrtc_environment.htm

Sorry for my bad English.

longdoan7421
  • 60
  • 1
  • 8
  • how can i run that HTML file ? just double click ? or any other node commands required ? and i got another sample from http://blog.felixhagspiel.de/index.php/posts/create-your-own-videochat-application-with-html-and-javascript but when i load localhost:portno it is opening , still loading . Any pblm ? – user2986042 Aug 23 '16 at 08:58
  • Do you load localhost with port which server is listening? – longdoan7421 Aug 23 '16 at 09:07
  • If the port is correct and page still loading, i think it is server's issue. – longdoan7421 Aug 23 '16 at 09:14
  • ok . i will check that . But how should i run HTML code ? simple run enough ? – user2986042 Aug 23 '16 at 09:19
  • In server code has `app.use(express.static(__dirname + '/static')); // client code goes in static directory`. So when you load localhost:port-server-listen, it will automatically load your default html file (index.html) in that directory. If your directory has client.html, you can access it through localhost:portno/client.html – longdoan7421 Aug 23 '16 at 09:34
  • inside the server code , `wss = new WebSocketServer({ server: server, port: 8000 });` . what should i add for server ? i am not hosting an server . i just copy on Linux machine folder . i got error on this line when i run server.js – user2986042 Aug 23 '16 at 11:10
  • Did you install `ws` package? Also, you have to install `express` package too. – longdoan7421 Aug 25 '16 at 03:01