Reputation: 454
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.
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.
Upvotes: 5
Views: 6263
Reputation: 73225
There is no API to create a WebSockets server as a Chrome extension. websockify contains a python class for creating WebSocket servers easily. See the tests/echo.py
example.
The ws://
prefix indicates an unencrypted WebSockets connection. Likewise, wss://
is for encrypted connections (using TLS/SSL). One or the other is required.
Pusher is a WebSockets service that provides a layer on top of raw WebSockets that does session management for you. You do not need a separate WebSockets server.
Upvotes: 1
Reputation: 5628
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.
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.
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.
Upvotes: 2