m}RW      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV W*ByteString should be exactly 4 bytes long X Apply mask YCreate a random mask WXYWXYZBehaves almost the same as the  iterParser function from the L attoparsec-enumerator package, with the exception that, while the iteratee  created by  iterParser always starts in a Continue state, this one will ? only ask for more data if the underlying parser needs it. That' s important H because e.g. network connection will block and wait for more data on a  ContinueC. For messages or frames the problem will not occur as we know the K length of the payload and therefore can determine EOF (= end of the frame  here). We use parsers that don'/t take data for validation in Protocols.Hybi10 ZZHIn order to have an even more high-level API, we define a typeclass for I values the user can receive from and send to the socket. A few warnings  apply: * Natively, everything is represented as a [, so this is the  fastest instance  You should only use the \ or the ] instance when you are > sure that the data is UTF-8 encoded (which is the case for   messages). M Messages can be very large. If this is the case, it might be inefficient to  use the strict ^ and ] instances. .For an end-user of this library, dealing with s would be a bit K low-level. This is why define another type on top of it, which represents ! data for the application layer. Different control messages  >The kind of message a server application typically deals with BThe type of a frame. Not all types are allowed for all protocols. 1A low-level representation of a WebSocket packet The connection couldn'4t be established or broke down unexpectedly. thrown  as an iteratee exception. 'the client closed the connection while & we were trying to receive some data. "todo: Also want this for sending.  The client sent malformed data. _The inverse of a parser `An alias so we don''t have to import attoparsec everywhere  _`   _`abcdeabcdeabcdeAError in case of failed handshake. Will be thrown as an iteratee  exception. (f condition). MTODO: This should probably be in the Handshake module, and is solely here to  prevent a cyclic dependency.  for example EOF came too early# (which is actually a parse error)  or for your own errors. (like  unknown path?) ?The request was well-formed, but the library user rejected it.  (e.g.  unknown path) CThe request was somehow invalid (missing headers or wrong security  token) We don'9t have a match for the protocol requested by the client.  todo: version parameter !Response to a (' "#$%&'Full request type ()*+,3(Internally used) HTTP headers and requested path. -./0Request headers gParse an initial request h Encode an HTTP upgrade response iAn upgrade response j Bad request  !"#$%&'()*+,-./0ghij  !"#$%&"#$%&'()*+()*+,-./-./0ghij123kUnique identifier for us. lVersion as used in the Sec-WebSocket-Version  header. This is usually ! not the same, or derivable from version, e.g. for hybi10, it's 8. mnoEParse and validate the rest of the request. For hybi10, this is just . validation, but hybi00 also needs to fetch a security token HTodo: Maybe we should introduce our own simplified error type here. (to 3 be amended with the RequestHttpPart for the user) p%Implementations of the specification 4Construct a close message 5Construct a ping message 6Construct a pong message 7Construct a text message 8Construct a binary message 123klmnop45678123klmnopklmnop456789qrstParse a frame uEncode a frame v9rs9rss :wxyz{|}:xy:xyy ~*Receives and checks the client handshake. I If this fails, we encountered a syntax error while processing the client's  request. That is very bad.  If it returns Left, we either don'$t support the protocol requested by  the client ( #) or the data the client sent doesn' t match the  protocol () J Otherwise, we are guaranteed that the client handshake is valid and have - generated a response ready to be sent back. FRespond to errors encountered during handshake. First argument may be  bottom.  ~~ )Internal state used by the demultiplexer  ';Used for asynchronous sending. <@The monad in which you can write WebSocket-capable applications Environment in which the < monad actually runs ="Options for the WebSocket program >?@Default options A9Receives the initial client handshake, then behaves like C. B9Receives the initial client handshake, then behaves like  D. CRun a < application on an 'Enumerator'/'Iteratee' pair, given L that you (read: your web server) has already received the HTTP part of the 0 initial request. If not, you might want to use B  instead. "If the handshake failed, throws a . Otherwise, executes the G supplied continuation. You should still send a response to the client  yourself. D Version of C, which allows you to specify custom options EspawnPingThread n* spawns a thread which sends a ping every n seconds M (if the protocol supports it). To be called after having sent the response. AReceive some data from the socket, using a user-supplied parser. Underlying iteratee version of . ILike receiveIteratee, but if the supplied parser is happy with no input,  we don'Et supply any more. This is very, very important when we have parsers  that don'$t necessarily read data, like hybi10's completeRequest. 3Execute an iteratee, wrapping attoparsec-enumeratee's ParseError into the 6 ParseError constructor (which is a ConnectionError). $Low-leven sending with an arbitrary _ F$Low-level sending with an arbitrary   GHSend a message to a sink. Might generate an exception if the underlying  connection is closed. HHIn case the user of the library wants to do asynchronous sending to the  socket, he can extract a ;* and pass this value around, for example,  to other threads. Get the current configuration Get the underlying protocol I Find out the < version used at runtime J0Throw an iteratee error in the WebSockets monad K0Catch an iteratee error in the WebSockets monad +Lift an Iteratee computation to WebSockets ;<=>?@ABCDEFGHIJK;<=>?>?@ABCDEFGHIJK LGProvides a simple server. This function blocks forever. Note that this J is merely provided for quick-and-dirty standalone applications, for real - applications, you should use a real server. Address to bind to Port to listen on Application to serve Never returns MThis function wraps C& in order to provide a simple API for  stand-alone servers. ECreate an enumerator which reads from a socket and yields the chunks ,Create an iterator which writes to a socket LMLM NRead a ; from the socket. Blocks until a frame is received. If the  socket is closed, throws ConnectionClosed (a ConnectionError) ANote that a typical library user will want to use something like  receiveByteStringData instead. OReceive a message PKReceive an application message. Automatically respond to control messages. Q5Receive a message, treating it as data transparently Send a "! to the socket immediately. R?A low-level function to send an arbitrary frame over the wire. SSend a text message TSend some binary data UKReject a request, sending a 400 (Bad Request) to the client and throwing a " RequestRejected (HandshakeError) VHAccept a request. After this, you can start sending and receiving data. W  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW=>?@<CDAB321:9LM0,-./'()*+!"#$%&   VUINOPQRFST;GH45678EJK  NOPQRSTUV  !"#$%&'()*+,,-./011234556789:;<=>?@A B C D E E F G H I J K L M N O P Q R S TUVWXYZ[\]^_`abcdefegbhdij<=>?@klmnopqrstuvwAxxyz{ B | | } ~    C D   websockets-0.4.0.0Network.WebSocketsNetwork.WebSockets.Mask*Network.WebSockets.Handshake.ShyIterParserNetwork.WebSockets.Types"Network.WebSockets.Protocol.Unsafe!Network.WebSockets.Handshake.HttpNetwork.WebSockets.Protocol"Network.WebSockets.Protocol.Hybi10"Network.WebSockets.Protocol.Hybi00Network.WebSockets.HandshakeNetwork.WebSockets.DemultiplexNetwork.WebSockets.MonadNetwork.WebSockets.SocketWebSocketsDatafromLazyByteStringtoLazyByteString DataMessageBinaryTextControlMessagePongPingCloseMessage FrameType PongFrame PingFrame CloseFrame BinaryFrame TextFrameContinuationFrameFrameframeFin frameType framePayloadConnectionErrorConnectionClosed ParseErrorHandshakeErrorOtherHandshakeErrorRequestRejectedMalformedRequest NotSupportedResponse responseCoderesponseMessageresponseHeaders responseBodyRequest requestPathrequestHeadersrequestResponseRequestHttpPartrequestHttpPathrequestHttpHeadersHeadersBinaryProtocol TextProtocolProtocolclosepingpongtextData binaryDataHybi10Hybi00Sink WebSocketsWebSocketsOptionsonPongdefaultWebSocketsOptionsrunWebSocketsHandshakerunWebSocketsWithHandshake runWebSocketsrunWebSocketsWithspawnPingThreadsendsendSinkgetSink getVersion throwWsError catchWsError runServer runWithSocket receiveFramereceivereceiveDataMessage receiveData sendFrame sendTextDatasendBinaryData rejectRequest acceptRequestMask maskPayload randomMask shyIterParserbytestring-0.9.2.0Data.ByteString.Lazy.Internal ByteString text-0.11.1.9Data.Text.Lazy.InternalData.Text.InternalData.ByteString.InternalEncoderDecodertransformers-0.2.2.0Control.Monad.Trans.ErrorError decodeRequestencodeResponse response101 response400version headerVersion encodeFrame decodeFrame finishRequestimplementationsHybi10_decodeFrameHybi10encodeFrameHybi10handshakeHybi10Hybi00_encodeFrameHybi00decodeFrameHybi00 divBySpaceshandshakeHybi00tryFinishRequest responseErrorDemultiplexStateunDemultiplexStateemptyDemultiplexState demultiplexunSink unWebSockets WebSocketsEnvoptions sendBuilderprotocolrunWebSocketsWith' receiveWithreceiveIterateereceiveIterateeShywrappingParseError sendIterateesendWithmkSend singleton builderSender getOptions getProtocol liftIteratee receiveEnumsendIter sendResponsefailHandshakeWith