/// /// HybridWebSocketSpec.kt /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE. /// https://github.com/mrousavy/nitro /// Copyright © 2024 Marc Rousavy @ Margelo /// package com.margelo.nitro.fastio import android.util.Log import androidx.annotation.Keep import com.facebook.jni.HybridData import com.facebook.proguard.annotations.DoNotStrip import com.margelo.nitro.core.* /** * A Kotlin class representing the WebSocket HybridObject. * Implement this abstract class to create Kotlin-based instances of WebSocket. */ @DoNotStrip @Keep @Suppress("RedundantSuppression", "KotlinJniMissingFunction", "PropertyName", "RedundantUnitReturnType", "unused") abstract class HybridWebSocketSpec: HybridObject() { @DoNotStrip private var mHybridData: HybridData = initHybrid() init { // Pass this `HybridData` through to it's base class, // to represent inheritance to JHybridObject on C++ side super.updateNative(mHybridData) } /** * Call from a child class to initialize HybridData with a child. */ override fun updateNative(hybridData: HybridData) { mHybridData = hybridData } // Properties // Methods @DoNotStrip @Keep abstract fun send(message: String): Unit @DoNotStrip @Keep abstract fun sendArrayBuffer(buffer: ArrayBuffer): Unit @DoNotStrip @Keep abstract fun connect(): Unit @DoNotStrip @Keep abstract fun close(code: Double, reason: String): Unit @DoNotStrip @Keep abstract fun ping(): Unit @DoNotStrip @Keep abstract fun onOpen(callback: (selectedProtocol: String) -> Unit): Unit @DoNotStrip @Keep private fun onOpen(callback: Func_void_std__string): Unit { val __result = onOpen(callback.toLambda()) return __result } @DoNotStrip @Keep abstract fun onClose(callback: (code: Double, reason: String) -> Unit): Unit @DoNotStrip @Keep private fun onClose(callback: Func_void_double_std__string): Unit { val __result = onClose(callback.toLambda()) return __result } @DoNotStrip @Keep abstract fun onError(callback: (error: String) -> Unit): Unit @DoNotStrip @Keep private fun onError(callback: Func_void_std__string): Unit { val __result = onError(callback.toLambda()) return __result } @DoNotStrip @Keep abstract fun onMessage(callback: (message: String) -> Unit): Unit @DoNotStrip @Keep private fun onMessage(callback: Func_void_std__string): Unit { val __result = onMessage(callback.toLambda()) return __result } @DoNotStrip @Keep abstract fun onArrayBuffer(callback: (buffer: ArrayBuffer) -> Unit): Unit @DoNotStrip @Keep private fun onArrayBuffer(callback: Func_void_std__shared_ptr_ArrayBuffer_): Unit { val __result = onArrayBuffer(callback.toLambda()) return __result } private external fun initHybrid(): HybridData companion object { private const val TAG = "HybridWebSocketSpec" init { try { Log.i(TAG, "Loading FastIO C++ library...") System.loadLibrary("FastIO") Log.i(TAG, "Successfully loaded FastIO C++ library!") } catch (e: Error) { Log.e(TAG, "Failed to load FastIO C++ library! Is it properly installed and linked? " + "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e) throw e } } } }