Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use HTML5 WebSockets for Chrome Extensions

I am trying to create a chrome extension using HTML5 WebSockets and can't get a clear example. I have a few questions that I hope the community can answer for me in a clear and concise manner.

  1. The WebSocket Server, can that be added to an Google Chrome Extension? Either way can someone tell me exactly what is needed to make a Server or include a decent link to a clear example?
  2. When connecting to the WebSocket Server everyone always has something like ws://localhost:port number. Is the ws required or what is the point of that? I don't know if this is meant to be a file location or what. And just to make sure the IP address and port number is where your server is located and what port it's listening on right?
  3. Websites like pusher at http://www.pusher.com/ is that just a way to send communication between two different devices and you still need a server or does this replace a server/can this replace a server.

I have done quite a bit of Google searching so its not like I don't know anything about this topic. I just don't understand all the different things and the websocket API does not give a definition of any of its functions and doesn't really explain anything about how to use it.

Some Links I have checked out: http://dev.w3.org/html5/websockets/ , http://jnext.org/index.html , http://www.pusher.com/ , http://jwebsocket.org/ , http://joshuakehn.com/blog/view/2/WebSocket-Tutorial-with-Node-js

I need something that does not need to be installed onto a computer. All server/client/coding needs to be javascript that can be placed into a chrome extension. Thank you for anyone who can help me.

like image 340
eric Avatar asked Nov 05 '22 20:11

eric


1 Answers

  1. It seems like you're saying you want to run a websocket server on the client? That's not going to be possible. You can't launch processes on a user's machine from a browser.

  2. ws indicates to use the web sockets protocol just like http indicates to use hyper text transfer protocol or ftp indicates to use file transfer protocol.

  3. Pusher is a service that hosts and runs a web socket server for you. You could also write your own web socket server and install it on your own server.

like image 157
Craig M Avatar answered Nov 11 '22 03:11

Craig M