ember.js - Architecture for a web2py + ember + websockets application -


i trying add quasi-real-time layer ember web application via websockets. thinking following setup:

frontend client <--> web2py server (rest api) <--->    ------       ^                                                | db |       |---> websockets server <--> bg services <-->    ------ 

whenever frontend logging in web2py server, providing rest api access data needed frontend, must connect "websockets server". server used bg services provide quasi-real-time data connected frontends.

the bg services background processes extracting complex data database, without request coming frontend, , pushing data connected clients, whenever ready.

i have questions have answered myself (i wrong here, please correct me):

  • a1: how know connected clients? guess websockets server knows clients connected
  • a2: how push messages frontends? send message websockets server, specifying group must distributed.
  • a3: how organize "websocket groups"? design strategy according data: example, if members of group must receive data belonging "organization", create websockets group each organization: push org-group, , connected frontends belonging org-group receive data.
  • a4: how push json? encode first, , send text. decode on client. (websockets can send text , binary data).

i not sure following:

  • b1: how push different endpoints in frontend? example, how push persons, posts, comments?
  • b2: how use single server rest api , websockets server?

according embersockets:

$window.app = ember.application.create({      socket: embersockets.extend({         host: 'localhost',         port: 8888,         controllers: ['index']     })  }); 

and according documentation on restadapter:

app.applicationadapter = ds.restadapter.extend({   host: 'https://api.example.com' }); 

is possible have single host url handle ws , http connection? not think having frontend connecting 2 different hosts (specially 2 different ports, maybe blocked in customer network) idea.

  • b3: server can use websockets? using apache http. use example tornado, supports websockets, how make tornado , apache play together? how tell client http connections apache, , ws connections tornado, using single url? matter of tweaking apache config, , redirect ws connections server?


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -