Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 1.38 KB

README.md

File metadata and controls

26 lines (19 loc) · 1.38 KB

EJBindingWebSocket

An Ejecta extension to introduce WebSocket support.

Attention

Ejecta now has native WebSocket support, so this extension is unnecessary. Proceed as you will…

Setup

EJBindingWebSocket depends on SocketRocket, so add all the files in SocketRocket/SocketRocket to the Ejecta project, followed by EJBindingWebSocket.h and EJBindingWebSocket.m.

Unlike Ejecta, SocketRocket requires ARC. Because of this, you will need to add the -fobjc-arc flag to SRWebSocket.m in Build Phases > Compile Sources.

Usage

var socket = new Ejecta.WebSocket('ws://192.168.0.2:8080')

socket.addEventListener('open', function() {})
socket.addEventListener('message', function(message) {})
socket.addEventListener('error', function(error) {})
socket.addEventListener('close', function() {})

socket.send('string')
socket.close()

Example

Inside EJBindingWebSocket/example you will find two files. index.js goes into your /App folder, while server.js is run with node with a single dependency: ws.