Core libraries and tools part for pro architecture. It's a submodule - use from this perspective http://git.maniak.pro/madmaniak/pro
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
626 B
28 lines
626 B
Primus = require('../../tools/communication/primus/primus')
|
|
|
|
global.Dialog =
|
|
|
|
init: ->
|
|
url = "#{location.protocol}//#{location.hostname}"
|
|
@primusI = Primus.connect "#{url}:8090"
|
|
@primusO = Primus.connect "#{url}:8091"
|
|
@pair_connections()
|
|
@listen_to_data()
|
|
|
|
pair_connections: ->
|
|
@primusI.on 'open', =>
|
|
@primusI.id (id) =>
|
|
@primusO.write id
|
|
render()
|
|
|
|
listen_to_data: ->
|
|
@primusO.on 'data', (data) ->
|
|
return if /primus::ping/.exec(data)
|
|
console.log data
|
|
Requests.receive data
|
|
|
|
send: (data) ->
|
|
console.log data
|
|
@primusI.write data
|
|
|
|
Dialog.init()
|
|
|