Похожие чаты

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 ответов

13 просмотров
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

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

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

а через ESC-код ?
Alexey Kulakov
29
30500 за редактор? )
Владимир
47
Чёт не понял, я ж правильной функцией воспользовался чтобы вывести отладочную информацию? но что-то она не ловится
notme
18
У меня есть функция где происходит это: write_bit(buffer, 1); write_bit(buffer, 0); write_bit(buffer, 1); write_bit(buffer, 1); write_bit(buffer, 1); w...
~
13
any reference of this implementation?
BitBuddha
29
Ⓐrtto, [4/23/24 7:02 PM] Please explain more fully how it is not working exactly, and what are the steps you are taking, and what error messages come or what happens. Ⓐrtto, ...
Ezza Kezza
2
sounds like people have lost their kaspa on tradeogre... does this mean tradeogre not trustworthy?
Ezza Kezza
15
Страшнейшая правда про списки ЦБ. С первых дней жизни P2P сферы, молодые человеки, начитавшись законодательной базы и "внутренних" документов, решили, что им противостоит сер...
Foxcool
3
Недавно Google Project Zero нашёл багу в SQLite с помощью LLM, о чём достаточно было шумно в определённых интернетах, которые сопровождались рассказами, что скоро всех "ибешни...
Alex Sherbakov
5
So much speculation in the last week. So much volatility in price. This is because Hedera has a GC that isn't using the network it's governing. Why aren't people asking why a...
Summit Seeker R
9
Карта сайта