Websockets or AJAX or both? -


i bit confused how 1 uses websockets. have set websocket server , able receive server , send server.

my question is. when using websockets, supposed drop ajax part completely? or supposed use websockets alongside ajax?

example:

i want use websockets on chat service on website users can log in. when logging in, use ajax. when on message page use websockets receive future messages, , send future messages. when navigating messages page, use ajax messages database.

is correct way of using websockets? or should in websockets since 1 user 1 active connection more efficient? or should 1 user have 1 websocket connection, still keep sending ajax requests server when navigating pages without reloading site, using ajax?

what best practice when creating large application users can log in, navigate pages load stuff async, still wanting bidirectional real time benefits of websockets on stuff messaging services , notification services on same website?

there no reason cannot use both. think solution depends on server side resources using. may need access server through websockets updates chat dialogue. may use different system user statistics or provide authentication.

i don't think there specific answer question varies depending on application in question.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -