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

Attaching Identifiers in Connect Request #385

Open
kaiavi opened this issue Jan 30, 2023 · 2 comments
Open

Attaching Identifiers in Connect Request #385

kaiavi opened this issue Jan 30, 2023 · 2 comments

Comments

@kaiavi
Copy link

kaiavi commented Jan 30, 2023

Hi, this is not an issue, but a query on how to use the SDK.

I have seen that in other language implementations, once can pass identifiers from client, maybe like serialid or mac or anything like that with the request, and some logic can be added in the server side based on this identifier (to group some into a group or other purposes)

How can we pass such identifiers in the CPP SDK? and how can we detect them from a node js server?

@veteri
Copy link

veteri commented Feb 5, 2023

You can do it using a map and passing that to io.connect().

std::map<std::string, std::string> headers;

// Socket io forces all these header keys lowercase, 
// so we write them lowercase to avoid confusion
headers["authorization"] = jwt;
io.connect(remoteHost, {}, headers);

@btgoodwin
Copy link

What would be the way to do this if the server expects the header to be an object, like { 'auth': { 'token': '<token>' }}?

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

No branches or pull requests

3 participants