websockets-json-1.0.0: Extras for working with websockets & JSON.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.WebSockets.Json

Description

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

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.