Import scripts/transport-bench/native-websocket-bench.kt.txt
This commit is contained in:
parent
13d8f21e8d
commit
1a52913f5b
|
|
@ -0,0 +1,7 @@
|
|||
// Injected only by the independent benchmark builder; not a production API.
|
||||
Function("sendSocket") { socketId: Int, payload: ByteArray ->
|
||||
require(socketId >= 0 && payload.isNotEmpty() && payload.size <= 65535)
|
||||
val context = appContext.reactContext as? ReactApplicationContext
|
||||
val module = requireNotNull(context?.getNativeModule(com.facebook.react.modules.websocket.WebSocketModule::class.java))
|
||||
module.sendBinary(payload.toByteString(), socketId)
|
||||
}
|
||||
Loading…
Reference in New Issue