question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Access channel from IO scope

See original GitHub issue

I’m trying to access a channel id from the io scope to send a message (right before they get kicked haha!): io.channel[player.id].emit('chat message', 'You have been kicked for cheating!'); And player.id is just the channel.id. But the above is not working. Is there a way to access a specific channel by id from the io scope?

This does work: io.channel[player.id].close();

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
yandeucommented, Jul 4, 2020

No, this is not possible yet.

But I guess I could forward the http request to the authentication function? Then you could get the ip using request.connection.remoteAddress or request.headers['x-forwarded-for'] (if behind a proxy).

Or you could store a unique key in localStorage and authenticate the user with it using the new authorization process.

Btw, thanks a lot for your sponsorship! It really helps a lot 😃

0reactions
yandeucommented, Jul 30, 2020

Will publish it soon to npm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Consumers — Channels 4.0.0 documentation
Consumers receive the connection's scope when they are called, which contains a lot of the information you'd find on the request object in...
Read more >
What scope is required to access a YouTube channel title ...
I am currently using the scopes with offline access: https://www.googleapis.com/auth/youtube.force-ssl; https://www.googleapis.com/auth ...
Read more >
Crash Course Kotlin Flows, Channels and Shared/State Flows
A channel is like a queue, it can receive data and it can be then consumed by another component.
Read more >
Use Kotlin coroutines with lifecycle-aware components
Kotlin coroutines provide an API that enables you to write asynchronous code. With Kotlin coroutines, you can define a CoroutineScope , which ...
Read more >
Connection device rules — resource groups Copy ... - IBM
This device address is referred to as the connection device. That is, the device to which the channel or initiator connects to issue...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found