Skip to content
Marius Melzer edited this page Jun 17, 2014 · 6 revisions

The palava protocol is JSON based and in the original palava-client and palava-machine transferred via websockets.

Join a room

Me -> Server:

{
	event: 'join_room',
	room_id: 'room_name',
	status: some_status_object*
}

Server -> Me:

{
	event: 'joined_room',
	own_id: my_signaling_id,
	peers: [ {
		peer_id: peers_signaling_id,
		status: some_status_object
	} ]
}

Server -> Others:

{
	event: 'new_peer',
	peer_id: id_of_new_peer
	status: some_status_object*
}

Leave a room

Leaving is done implicitly by closing the (e.g. websocket) connection to the server.

Server -> Others:

{
	event: 'peer_left'
	sender_id: id_of_left_peer
}

Communication between peers of the same room

As recipient of these messages, you get only the data-object extended by the server with a sender_id attribute.

Exchange of an ICE candidate (http://www.ietf.org/rfc/rfc5245.txt):

{
	event: 'send_to_peer',
	peer_id: id_of_recipient,
	data: {
		event: 'ice_candidate',
		sdpmlineindex: icecandidate.sdpMLineIndex,
		sdpmid: icecandidate.sdpMid,
		candidate: icecandidate.candidate
	}
}

"icecandidate" is an RTCIceCandidate object that you can get via the onicecandidate callback of an RTCPeerConnection.

Sending an offer (with a RTCSessionDescription):

{
	event: 'send_to_peer',
	peer_id: id_of_recipient,
	data: {
		event: 'offer'
		sdp: session_description_string
	}
}

Sending an answer (with a RTCSessionDescription):

{
	event: 'send_to_peer',
	peer_id: id_of_recipient,
	data: {
		event: 'answer'
		sdp: session_description_string
	}
}
  • the status object

Example status object:

{
	user_agent = "firefox",
	name: 'shown user name"
}

The user_agent may be 'firefox' or 'chrome' (for chrome and opera)

Me -> Server:

{
	event: 'update_status'
	status: some_status_object
}

Server -> Others:

{
	event: 'peer_updated_status'
	sender_id: id_of_peer
	status: some_status_object
}

Server status

Server -> Me:

{
	event: 'error',
}

Server -> Me:

{
	event: 'shutdown'
}
Clone this wiki locally