Giter VIP home page Giter VIP logo

Comments (8)

Mobinkarimi1 avatar Mobinkarimi1 commented on May 25, 2024 1

در اسناد همچنین چندین مشتری را راه اندازی می کنند: https://socket.io/docs/v4/namespaces/#client-initialization

const socket = io("https://example.com"); // or io("https://example.com/"), the main namespace
const orderSocket = io("https://example.com/orders"); // the "orders" namespace
const userSocket = io("https://example.com/users"); // the "users" namespace

ممکن است بخواهید اسناد کتابخانه را بررسی کنید یا با توسعه دهنده در https://github.com/doghappy/socket.io-client-csharp تماس بگیرید

ok , thanks

from socketiounity.

itisnajim avatar itisnajim commented on May 25, 2024 1

in your server and in your socket connection or in an event callback
call the below line to make the client attached to a room (e.g: 'your-room')

// inside io.on('connection', (socket) => {...}) 
// or inside socket.on('im-in', data => {...}) <== but for this event to be triggered in you c# you have to call socket.Emit("im-in");
socket.join('your-room');

after this call emit when needed
io.in('your-room').emit("start game");

from socketiounity.

Mobinkarimi1 avatar Mobinkarimi1 commented on May 25, 2024

https://socket.io/docs/v4/namespaces/
How to Client initialization?

from socketiounity.

itisnajim avatar itisnajim commented on May 25, 2024

this packagee it's a Wrapper for socket.io-client-csharp, so you can look there for further info.
according to:
doghappy/socket.io-client-csharp#112
you can do like this:

client = new SocketIOUnity("http://YOUR_SERVER_ADDRESS/your-namespace", new SocketIOOptions
{
    ...
});

from socketiounity.

Mobinkarimi1 avatar Mobinkarimi1 commented on May 25, 2024

This solution creates a new socket connection, which is not ideal at all
I want to separate the application logic on a connection, for example, the login page has one namespace and the registration page has another namespace.

from socketiounity.

itisnajim avatar itisnajim commented on May 25, 2024

in the docs also they init multiple clients:
https://socket.io/docs/v4/namespaces/#client-initialization

const socket = io("https://example.com"); // or io("https://example.com/"), the main namespace
const orderSocket = io("https://example.com/orders"); // the "orders" namespace
const userSocket = io("https://example.com/users"); // the "users" namespace

you may want to check with the library's documentation or reach out to the developer at
https://github.com/doghappy/socket.io-client-csharp

from socketiounity.

Mobinkarimi1 avatar Mobinkarimi1 commented on May 25, 2024
your-namespace

io.in(my-namespace).emit("start game");
Apparently this solution is suitable, do you know how to use it in C#?

from socketiounity.

mrbaz1997 avatar mrbaz1997 commented on May 25, 2024

can I use Dynamic namespace in client without create new socket connection?
the Namespace property only has getter and I can't change it

from socketiounity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.