Похожие чаты

This, you mean? From the npm package's readme: io.on('connection', socket =>

{
socket.emit('request', /* … */); // emit an event to the socket
io.emit('broadcast', /* … */); // emit an event to all connected sockets
socket.on('reply', () => { /* … */ }); // listen to the event
});

18 ответов

16 просмотров
Simen- Автор вопроса

There is a clear difference here between sending to a socket (socket.) and sending to the server (io.)

Simen
There is a clear difference here between sending t...

I have one use case in which I have some data in array and each array element I want to send to client one by one. So when first element is send via websocket I want to send second element from array only when we get response for first element from client and this should happen for all the array elements. How can this be done in websockets any suggestions or pointers?

Friday Candour [Ask to PM]
Please can I ask a question 🙋

This isn't a classroom, don't ask to ask. Just ask the question and if someone can, they will help

MUTHU・KUMAR 「メーカー」 🔺
This isn't a classroom, don't ask to ask. Just ask...

If you do not have all the materials to learn javascript, or maybe you later get them after a long time, How do you learn on your own and still learn well, and how do you get to ever make money with all you have learned, am a javascript beginner, please advise me, I just can't code anymore I have a bad pc and I'm very frustrated, I don't want to stop code

Friday Candour [Ask to PM]
If you do not have all the materials to learn java...

Try freeCodeCamp.org, they have easy to follow courses that go from beginner levels to making you job-ready

Thomas
Sounds pretty straightforward to me

I have 10 messages on server which I fetch from DB. Now i want to send message one by one. Lets say if I send 1st msg then I want to send second message only when we get response for 1st message. If we dont get response to 1st message then dont send second message. How will server know response is received for first message? How to keep track of that

Thomas
Well you can wait for it

But how will you track if we have received response for 1st msg and then we send second similarly for 3,4,5th messages

Thomas
A loop

loop does not work in case of socket messaging I read few blogs and they have mentioned there will be some deplay in messaging if we loop over individual messages. I have one more idea should I send entire data i.e 10 messages to client and then this looping logic will get handled on client side so I will send bulk data via socket i.e 10 messages in this case

Adi
loop does not work in case of socket messaging I r...

You can do bulking if that works for you, it would probably even be faster

Thomas
You can do bulking if that works for you, it would...

By bulk I mean to say I have array of 10 messages with each message is object with some info so I will be sending entire array from server to client instead of sending single object one by one. Just wanted to know will this cause any performance issue? If I send data in bulk? Is there any limit on payload size?

Adi
By bulk I mean to say I have array of 10 messages ...

No limits if you use highlevel libraries like socket.io

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта