Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property 'of' does not exist on type 'Socket<DefaultEventsMap, DefaultEventsMap>'. #1600

Open
ciprianmacovei opened this issue Dec 14, 2023 · 6 comments
Labels
question Further information is requested

Comments

@ciprianmacovei
Copy link

ciprianmacovei commented Dec 14, 2023

Describe the bug

i can't find the of property to defined a namespace
also cant find socket.to ... to send to specific room >.<

To Reproduce

Socket.IO client version: ^4.7.2

Client

import io from 'socket.io-client';

 const socket = io({
          transports: ['websocket'],
          autoConnect: true,
        })
       
socket.of....

Expected behavior
wanted to have autocomplete on all methods like in the docs .

Platform:

  • mac

Additional context
it s about typescript or idk I tried to install @types but same result ....

@ciprianmacovei ciprianmacovei added the to triage Waiting to be triaged by a member of the team label Dec 14, 2023
@ciprianmacovei
Copy link
Author

Screenshot 2023-12-14 at 15 16 16 Screenshot 2023-12-14 at 15 16 22

@darrachequesne
Copy link
Member

Hi!

socket.to() and io.of() are available on the server side, not the client side.

Reference: https://socket.io/docs/v4/server-api/

@darrachequesne darrachequesne added question Further information is requested and removed to triage Waiting to be triaged by a member of the team labels Dec 14, 2023
@ciprianmacovei
Copy link
Author

ciprianmacovei commented Dec 14, 2023

thank u for answering :) im using python on the server side, okey so yeah from the server side I know how to do it, but from client side how can I pick a namespace and a room ? is there something I'm missing. Because I was looking at https://socket.io/docs/v4/namespaces/ and there was nothing mentioning it s server side. Am I understanding it correctly ?
thank u for ur pacience

@ciprianmacovei
Copy link
Author

because on python i have the emit function with kwargs and have room , namespace but in client ... i have only emit with first arg event name and second the data I'm sending :-?

@ciprianmacovei
Copy link
Author

ciprianmacovei commented Dec 14, 2023

so for u to understand my flow:
every time a user logs in he makes a emit on the connected event and then from the server side i join him on the notifications namespace and a specific room, somehome there must me o possibility to send data only to that specific room, and listen to that specific room, something opposite to broadcast, how can i make this ?
ps: be is fully functional, I don't know how to do it from client

@ciprianmacovei
Copy link
Author

i think i understand so the be is the source of truth, so when I say send it to room = x on the client when I listen it will send only to the rooms that I joined from the be

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants