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

feat(voice)!: add support for node.js #931

Merged
merged 10 commits into from
Apr 12, 2024

Conversation

viztea
Copy link
Contributor

@viztea viztea commented Apr 3, 2024

breaking change (for anyone who uses the voice socket) to allow sending & receiving voice in Kotlin/Node.js.

I'm not sure what branch to target but this PR depends on #855


val ip: InetSocketAddress = connection.socket.discoverIp(server!!, ssrc!!.toInt())
val ip: SocketAddress = connection.socket.discoverIP(server.value!!, ssrc.value!!.toInt())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While testing, ssrc would be null here, this fixes it 🤷🏼

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the atomic delegate is broken?

fun main(args: Array<String>) = runBlocking {
val kord = Kord(args.firstOrNull() ?: error("Missing token"))
@OptIn(DelicateCoroutinesApi::class)
fun main(args: Array<String>) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to have nonNative main function which is suspending and then use runBlocking on native

voice/build.gradle.kts Outdated Show resolved Hide resolved
@@ -58,7 +58,7 @@ public class VoiceConnection(
connectionDetachDuration: Duration
) {
public val scope: CoroutineScope =
CoroutineScope(SupervisorJob() + CoroutineName("kord-voice-connection[${data.guildId.value}]"))
CoroutineScope(Dispatchers.Default + SupervisorJob() + CoroutineName("kord-voice-connection[${data.guildId.value}]"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this use the Kord dispatcher?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

voice doesn't depend on core. If the scope was able to be configured it could be overridden in the core-voice module.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then that's what we should do


val ip: InetSocketAddress = connection.socket.discoverIp(server!!, ssrc!!.toInt())
val ip: SocketAddress = connection.socket.discoverIP(server.value!!, ssrc.value!!.toInt())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the atomic delegate is broken?

@viztea viztea changed the title feat(voice)!: add support for voice feat(voice)!: add support for node.js Apr 3, 2024
@DRSchlaubi
Copy link
Member

DRSchlaubi commented Apr 4, 2024

Could you check why the CI failed?
It looks like it can't find the nodejs api wrapper for some reason
Log

@viztea
Copy link
Contributor Author

viztea commented Apr 5, 2024

Could you check why the CI failed? It looks like it can't find the nodejs api wrapper for some reason Log

i was stupid and made a typo lol, should be fine now

@viztea viztea requested a review from DRSchlaubi April 5, 2024 11:24
@DRSchlaubi DRSchlaubi merged commit 35227fc into kordlib:feature/native Apr 12, 2024
6 checks passed
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

Successfully merging this pull request may close these issues.

2 participants