Sha256: 01861e68f7df6c21a0941dd330d6a030287300dfd6a848be454aacb25fafa72f
Contents?: true
Size: 1001 Bytes
Versions: 2
Compression:
Stored size: 1001 Bytes
Contents
x = require '../helper/WebSocket-Node-wrapper.js' ### MODIFICATIONS!!! window does not exist @_conn constructor use x.Websocket(@url) ### ### WebSocket Interface for the WebSocketRails client. ### class WebSocketRails.WebSocketConnection extends WebSocketRails.AbstractConnection connection_type: 'websocket' constructor: (@url, @dispatcher) -> super if @url.match(/^wss?:\/\//) console.log "WARNING: Using connection urls with protocol specified is depricated" # else if window.location.protocol == 'https:' # @url = "wss://#{@url}" else @url = "ws://#{@url}" @_conn = new x.WebSocket(@url) @_conn.onmessage = (event) => event_data = JSON.parse event.data @on_message(event_data) @_conn.onclose = (event) => @on_close(event) @_conn.onerror = (event) => @on_error(event) close: -> @_conn.close() send_event: (event) -> super @_conn.send event.serialize()
Version data entries
2 entries across 2 versions & 1 rubygems