I've seen many apps use two separate servers to handle traffic. These services have a RESTful HTTP api server AND a websocket gateway.

I guess I'm not sure how the websocket gateway interacts with the database of the RESTful server. Does the websocket server make HTTP GET,PUSH,etc commands to the RESTful API in the background? Does the websocket server have direct write access to the database? Or should the websocket and API server be seperate?

  • I guess I'm not sure how the websocket gateway interacts with the database of the RESTful server. -- The same way that the RESTful server does. – Robert Harvey Nov 8 at 21:28
  • Does the websocket server make HTTP GET,PUSH,etc commands to the RESTful API in the background? -- It can, but typically it would communicate with the database server directly. Why involve another middleman if you don't have to? – Robert Harvey Nov 8 at 21:29
  • Does the websocket server have direct write access to the database? -- It does if you give it such access. – Robert Harvey Nov 8 at 21:30
  • should the websocket and API server be seperate? -- What API server? The REST interface and the Websocket interface use different protocols, so you'll need different endpoints. – Robert Harvey Nov 8 at 21:30
  • @RobertHarvey Okay thanks. If the websocket gateway & RESTful API are two separate servers, how will I coordinate write/reading to the database? I haven't learned too much about databases yet. I'm using Scylla. Does the database run on its own servers that accepts read/write? How to I support two different servers interacting with the database without running into deadlock problems and such? Thanks again. – wdavies973 Nov 8 at 21:40

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.