Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Add socket channel params (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
graszka22 authored Feb 24, 2023
1 parent 9716396 commit 598adcc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.membraneframework.rtc.events.ReceivableEvent
import org.membraneframework.rtc.events.SendableEvent
import org.membraneframework.rtc.events.serializeToMap
import org.membraneframework.rtc.utils.ClosableCoroutineScope
import org.membraneframework.rtc.utils.SocketChannelParams
import org.membraneframework.rtc.utils.SocketConnectionParams
import org.phoenixframework.Channel
import org.phoenixframework.Socket
Expand All @@ -16,7 +17,8 @@ public class PhoenixTransport constructor(
private val url: String,
private val topic: String,
private val ioDispatcher: CoroutineDispatcher,
private val params: SocketConnectionParams? = emptyMap()
private val params: SocketConnectionParams? = emptyMap(),
private val socketChannelParams: SocketChannelParams = emptyMap()
) : EventTransport {

private lateinit var coroutineScope: CoroutineScope
Expand Down Expand Up @@ -67,7 +69,7 @@ public class PhoenixTransport constructor(
this.listener?.onClose()
}

channel = socket!!.channel(topic)
channel = socket!!.channel(topic, socketChannelParams)

channel?.join(timeout = 3000L)
?.receive("ok") { _ ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ package org.membraneframework.rtc.utils
typealias Payload = Map<String, Any?>
typealias Metadata = Map<String, Any>
typealias SocketConnectionParams = Map<String, Any>
typealias SocketChannelParams = Map<String, Any>
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,13 @@ class RoomViewModel(
room.value = MembraneRTC.connect(
appContext = getApplication(),
options = ConnectOptions(
transport = PhoenixTransport(url, "room:$roomName", Dispatchers.IO, params),
transport = PhoenixTransport(
url,
"room:$roomName",
Dispatchers.IO,
params,
mapOf("isSimulcastOn" to true)
),
config = mapOf("displayName" to displayName),
encoderOptions = EncoderOptions(
encoderType = EncoderType.HARDWARE
Expand Down

0 comments on commit 598adcc

Please sign in to comment.