N
N
Nikita Reshetnyak2019-07-15 19:57:26
Node.js
Nikita Reshetnyak, 2019-07-15 19:57:26

How to implement dynamic content via socket.io?

Good afternoon.
How to implement dynamic content via socket.io? Users have posts, they are currently clumsy, in order for the post to be displayed in the user profile, you need to reload the page. Tell me, in which direction to dig, so that when the user clicks the "Submit" button, the post is immediately displayed in the profile and written to the database?
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kr_ilya, 2019-07-15
@kr_ilya

If you just need the post to appear on the page, then why bother with sockets at all, they are not made for such situations.
1. We send the post data to the server, if everything is fine, we enter it into the database and send a positive response to the client.
2. If the response from the server is positive, we generate a post code with data and insert it into the page.
Everything!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question