Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Extras for working with websockets & JSON.
This module allows to write simple websocket clients following a request/response pattern over some JSON encoded data.
Synopsis
- sendJson :: forall m. MonadIO m => Connection -> Encoding -> m ()
- receiveJson :: forall m a. (MonadThrow m, MonadIO m) => Connection -> (Value -> Parser a) -> m a
- data MalformedOrUnexpectedResponseException = MalformedOrUnexpectedResponse {
- bytesReceived :: !ByteString
- errorPath :: !JSONPath
- hint :: !String
Documentation
sendJson :: forall m. MonadIO m => Connection -> Encoding -> m () Source #
Send some JSON encoding through the given connection.
receiveJson :: forall m a. (MonadThrow m, MonadIO m) => Connection -> (Value -> Parser a) -> m a Source #
Synchronously receive some JSON-encoded bytes through the given connection.
Throws MalformedOrUnexpectedResponseException
upon failure.
data MalformedOrUnexpectedResponseException Source #
An exception thrown when failing to decode a JSON payload.
MalformedOrUnexpectedResponse | |
|