Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
302 views
in Technique[技术] by (71.8m points)

web services - Basic webserver state - daemon or new process per web-hit?

I am trying to write an online system, where info is distributed via websockets to interested clients in realtime from one or many datasources (also connected via websocket). (Something like SignalR)

This seems to be a three part process:

  1. I can write all the client code to interface with a websocket process on the server
  2. I can write the code for the datasource to send data to my web app via websocket
  3. Some system needs to accept data from step 2, and optionally distribute to clients from step 1

I fundamentally don't know how step three operates. I understand serving a static or dynamic page to a browser, but that state isn't changing in a material way, and each server request will result in the same output. Easy.

Questions:

  • Do I need a daemon running 24/7 on the server keeping realtime info from step 2 in memory, and distributing to step 1 clients?

  • If the server-side websocket from step 2 gets info, how does it communicate with the websocket handling step 1 clients?
    It can't be via database, because then the step 1 websocket would have to keep polling the database, which seems extremely silly.

There is something fundamental that I don't understand, and haven't found a primer for on the web.
I am on a shared linux host.

question from:https://stackoverflow.com/questions/66066268/basic-webserver-state-daemon-or-new-process-per-web-hit

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...