Skip to content

Instantly share code, notes, and snippets.

@paulotaylor
paulotaylor / OpenAIRealtimeWebSocket.kt
Last active November 19, 2024 06:28
Simple Kotlin OpenAI Websocket implementation of the Realtime API
import android.util.Log
import io.ktor.util.decodeBase64Bytes
import io.ktor.util.encodeBase64
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import okhttp3.WebSocket
import okhttp3.WebSocketListener
import okio.ByteString
import org.json.JSONArray