WebSocket are more like a two-way conversation that provides full-duplex communication channels over a single TCP connects.

Lets look over a couple of terms. protocol, duplex communication, TCP connections.

-A protocol is an agreement between people on a way in which something is usually done. “Protocol” is just a convention. In this case, a convention for connecting, transmitting, receiving, and disconnecting.

When you visit a traditional web page, each resource (image, css, javascript file, etc.) that the browser comes across when rendering the document creates a new request to the server using the HTTP protocol.

WebSockets use a different protocol from HTTP, one that makes a connection and then keeps it open until you leave the page. It’s a bit confusing because WebSockets actually begin communication over HTTP, but then transparently “upgrade” to the special WebSockets protocol. Communication over this upgraded connection is not the same as the old-school HTTP GET/POST/etc, it’s a special language that supports simultaneous data transfer in both directions.

– A duplex communication refers to the transmission of data in two directions simultaneously. For example, a telephone is a full-duplex device because both parties can talk at once. In contrast to walkie-talkie is  half-duplex device because only one party can transmit at a time.

– TCP works with the Internet Protocol (IP), which defines how computers send packets of data to each other. TCP (Transmission Control protocol) is a standard that defines how to establish and maintain a network conversation via which application program can exchange data. TCP works with the Internet Protocol.

Together, TCP and IP are the basic rules defining the Internet.

wrapping I created a web socket client and

Screen Shot 2014-11-14 at 11.43.41 AM

websocket server

Screen Shot 2014-11-14 at 11.41.24 AM


This sketch allows a couple of people -using the same local ip address- to play with a frequency’s amplitude. As you move the slider in the index.html, the player should move accordingly.

I defined a class that represents a single caller. The constructor of the Player class takes an argument named socket of type WebSocket.







Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s