GraphQLWebSocketAdapter

open class GraphQLWebSocketAdapter(channel: Channel<OperationMessage<*>>, objectMapper: ObjectMapper, dispatcher: CoroutineDispatcher) : WebSocketAdapter, CoroutineScope

WebSocketAdapter implementation that bridges incoming WebSocket events into a coroutine Channel to be handled by a consumer, and provides access to the remote for sending messages to the client.

Constructors

GraphQLWebSocketAdapter
Link copied to clipboard
fun GraphQLWebSocketAdapter(channel: Channel<OperationMessage<*>>, objectMapper: ObjectMapper, dispatcher: CoroutineDispatcher = Dispatchers.IO)

Types

Companion
Link copied to clipboard
object Companion

Functions

getRemote
Link copied to clipboard
open fun getRemote(): RemoteEndpoint
getSession
Link copied to clipboard
open fun getSession(): Session
isConnected
Link copied to clipboard
open fun isConnected(): Boolean
isNotConnected
Link copied to clipboard
open fun isNotConnected(): Boolean
onWebSocketBinary
Link copied to clipboard
open override fun onWebSocketBinary(p0: ByteArray, p1: Int, p2: Int)
onWebSocketClose
Link copied to clipboard
open override fun onWebSocketClose(statusCode: Int, reason: String?)
Notify channel that the stream is finished
onWebSocketConnect
Link copied to clipboard
open override fun onWebSocketConnect(p0: Session)
onWebSocketError
Link copied to clipboard
open override fun onWebSocketError(cause: Throwable)
Just log the error, and rely on the onWebSocketClose callback to clean up
onWebSocketText
Link copied to clipboard
open override fun onWebSocketText(message: String)
Parse incoming messages as OperationMessages, then send them to the channel consumer
sendMessage
Link copied to clipboard
internal fun sendMessage(message: OperationMessage<*>)
Convenience method for writing an OperationMessage back to the client in json format Must be called from the Subscriber's observation context
internal fun <T : Any> sendMessage(type: OperationType<T>, id: String?, payload: T? = null)
Convenience method for writing the components of an OperationMessage back to the client in json format Must be called from the Subscriber's observation context

Properties

channel
Link copied to clipboard
val channel: Channel<OperationMessage<*>>
coroutineContext
Link copied to clipboard
open override val coroutineContext: CoroutineContext
objectMapper
Link copied to clipboard
val objectMapper: ObjectMapper
objectWriter
Link copied to clipboard
val objectWriter: ObjectWriter
remote
Link copied to clipboard
private val remote: RemoteEndpoint
session
Link copied to clipboard
private val session: Session