Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Websocket works incorrectly #487

Open
AkioSarkiz opened this issue May 1, 2021 · 7 comments
Open

Websocket works incorrectly #487

AkioSarkiz opened this issue May 1, 2021 · 7 comments

Comments

@AkioSarkiz
Copy link

AkioSarkiz commented May 1, 2021

  1. PHP 8, swoole 4.6.6
  2. Laravel 8
  3. 2.8.1
  4. When i send emit to concrete user, message sent to current user + my id;
  5. I upload images with code and result.

it's my route

Websocket::on('example', function ($websocket, $data) {
   $websocket->toUserId([1])->emit('notification', 'only for you message id: 1');
});

User with login=admin & id=2, sent example emit and his got notification for user by id 1.
img

User with login=user & id=1, too his got too this message.
img

Notice: When i emit from user 1, user 2 don't receiveding message.

P.S.
from docs
img

@Arkanius
Copy link
Contributor

Thanks for open this issue!

I'll check it out

@AkioSarkiz
Copy link
Author

Three months have passed. And the bug was not fixed

@albertcht
Copy link
Member

albertcht commented Aug 9, 2021

Hi @Arkanius ,

What is your expected result? Can't understand your question yet.

Websocket::on('example', function ($websocket, $data) {
   $websocket->toUserId([1])->emit('notification', 'only for you message id: 1');
});

It will listen to example event, and always send a message to user 1 when this event is triggered.

@Arkanius
Copy link
Contributor

Arkanius commented Aug 9, 2021

Hi @albertcht!

I think he's saying that the "emit" is always sending the message to the user with id 1 and 2 when it should send just to the user with id 1

@AkioSarkiz
Copy link
Author

yes, if user with id 2 send a message to only for 1, user with id 1 gets message, but and user with id 2 gets message

@Arkanius
Copy link
Contributor

@AkioSarkiz What about the other users? I mean, if you have user 3. This user will get the message as well?

@AkioSarkiz
Copy link
Author

AkioSarkiz commented Aug 28, 2021

@Arkanius no, only current (frist) + second

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants