var searchIndex = {}; searchIndex["ws"] = {"doc":"Usage\n-----","items":[[3,"Error","ws","A struct indicating the kind of error that has occured and any precise details of that error.",null,null],[12,"kind","","",0,null],[12,"details","","",0,null],[3,"Sender","","A representation of the output of the WebSocket connection. Use this to send messages to the\nother endpoint.",null,null],[3,"Handshake","","A struct representing the two halves of the WebSocket handshake.",null,null],[12,"request","","The HTTP request sent to begin the handshake.",1,null],[12,"response","","The HTTP response from the server confirming the handshake.",1,null],[12,"peer_addr","","The socket address of the other endpoint. This address may\nbe an intermediary such as a proxy server.",1,null],[12,"local_addr","","The socket address of this enpoint.",1,null],[3,"Request","","The handshake request.",null,null],[3,"Response","","The handshake response.",null,null],[3,"Settings","","WebSocket settings",null,null],[12,"max_connections","","The maximum number of connections that this WebSocket will support.\nThe default setting is low and should be increased when expecting more\nconnections because this is a hard limit and no new connections beyond\nthis limit can be made until an old connection is dropped.\nDefault: 100",2,null],[12,"panic_on_new_connection","","Whether to panic when unable to establish a new TCP connection.\nDefault: false",2,null],[12,"panic_on_shutdown","","Whether to panic when a shutdown of the WebSocket is requested.\nDefault: false",2,null],[12,"protocols","","A protocol string representing the subprotocols that this WebSocket can support. This will\nbe sent in Requests to server endpoints to help determine a subprotocol if any for the\nconnection.\nDefault: None",2,null],[12,"extensions","","A WebSocket extension string indicating the extensions that this WebSocket can support.\nDefault: None",2,null],[12,"fragments_capacity","","The maximum number of fragments the connection can handle without reallocating.\nDefault: 10",2,null],[12,"fragments_grow","","Whether to reallocate when `fragments_capacity` is reached. If this is false,\na Capacity error will be triggered instead.\nDefault: true",2,null],[12,"fragment_size","","The maximum length of outgoing frames. Messages longer than this will be fragmented.\nDefault: 65,535",2,null],[12,"in_buffer_capacity","","The size of the incoming buffer. A larger buffer uses more memory but will allow for fewer\nreallocations.\nDefault: 2048",2,null],[12,"in_buffer_grow","","Whether to reallocate the incoming buffer when `in_buffer_capacity` is reached. If this is\nfalse, a Capacity error will be triggered instead.\nDefault: true",2,null],[12,"out_buffer_capacity","","The size of the outgoing buffer. A larger buffer uses more memory but will allow for fewer\nreallocations.\nDefault: 2048",2,null],[12,"out_buffer_grow","","Whether to reallocate the incoming buffer when `out_buffer_capacity` is reached. If this is\nfalse, a Capacity error will be triggered instead.\nDefault: true",2,null],[12,"panic_on_internal","","Whether to panic when an Internal error is encountered. Internal errors should generally\nnot occur, so this setting defaults to true as a debug measure, whereas production\napplications should consider setting it to false.\nDefault: true",2,null],[12,"panic_on_capacity","","Whether to panic when a Capacity error is encountered.\nDefault: false",2,null],[12,"panic_on_protocol","","Whether to panic when a Protocol error is encountered.\nDefault: false",2,null],[12,"panic_on_encoding","","Whether to panic when an Encoding error is encountered.\nDefault: false",2,null],[12,"panic_on_io","","Whether to panic when an Io error is encountered.\nDefault: false",2,null],[12,"masking_strict","","The WebSocket protocol requires frames sent from client endpoints to be masked as a\nsecurity and sanity precaution. Enforcing this requirement, which may be removed at some\npoint may cause incompatibilities. If you need the extra security, set this to true.\nDefault: false",2,null],[12,"key_strict","","The WebSocket protocol requires clients to verify the key returned by a server to ensure\nthat the server and all intermediaries can perform the protocol. Verifying the key will\nconsume processing time and other resources with the benifit that we can fail the\nconnection early. The default in WS-RS is to accept any key from the server and instead\nfail late if a protocol error occurs. Change this setting to enable key verification.\nDefault: false",2,null],[3,"WebSocket","","The WebSocket struct. A WebSocket can support multiple incoming and outgoing connections.",null,null],[3,"Builder","","Utility for constructing a WebSocket from various settings.",null,null],[4,"ErrorKind","","The type of an error, which may indicate other kinds of errors as the underlying cause.",null,null],[13,"Internal","","Indicates an internal application error.\nThe WebSocket will automatically attempt to send an Error (1011) close code.",3,null],[13,"Capacity","","Indicates a state where some size limit has been exceeded, such as an inability to accept\nany more new connections.\nIf a Connection is active, the WebSocket will automatically attempt to send\na Size (1009) close code.",3,null],[13,"Protocol","","Indicates a violation of the WebSocket protocol.\nThe WebSocket will automatically attempt to send a Protocol (1002) close code, or if\nthis error occurs during a handshake, an HTTP 400 reponse will be generated.",3,null],[13,"Encoding","","Indicates that the WebSocket received data that should be utf8 encoded but was not.\nThe WebSocket will automatically attempt to send a Invalid Frame Payload Data (1007) close\ncode.",3,null],[13,"Io","","Indicates an underlying IO Error.\nThis kind of error will result in a WebSocket Connection disconnecting.",3,null],[13,"Parse","","Indicates a failure to parse an HTTP message.\nThis kind of error should only occur during a WebSocket Handshake, and a HTTP 500 response\nwill be generated.",3,null],[13,"Queue","","Indicates a failure to send a command on the internal EventLoop channel. This means that\nthe WebSocket is overloaded and the Connection will disconnect.",3,null],[13,"Custom","","A custom error kind for use by applications. This error kind involves extra overhead\nbecause it will allocate the memory on the heap. The WebSocket ignores such errors by\ndefault, simply passing them to the Connection Handler.",3,null],[4,"Message","","An enum representing the various forms of a WebSocket message.",null,null],[13,"Text","","A text WebSocket message",4,null],[13,"Binary","","A binary WebSocket message",4,null],[4,"CloseCode","","Status code used to indicate why an endpoint is closing the WebSocket connection.",null,null],[13,"Normal","","Indicates a normal closure, meaning that the purpose for\nwhich the connection was established has been fulfilled.",5,null],[13,"Away","","Indicates that an endpoint is "going away", such as a server\ngoing down or a browser having navigated away from a page.",5,null],[13,"Protocol","","indicates that an endpoint is terminating the connection due\nto a protocol error.",5,null],[13,"Unsupported","","Indicates that an endpoint is terminating the connection\nbecause it has received a type of data it cannot accept (e.g., an\nendpoint that understands only text data MAY send this if it\nreceives a binary message).",5,null],[13,"Invalid","","Indicates that an endpoint is terminating the connection\nbecause it has received data within a message that was not\nconsistent with the type of the message (e.g., non-UTF-8 [RFC3629]\ndata within a text message).",5,null],[13,"Policy","","Indicates that an endpoint is terminating the connection\nbecause it has received a message that violates its policy. This\nis a generic status code that can be returned when there is no\nother more suitable status code (e.g., Unsupported or Size) or if there\nis a need to hide specific details about the policy.",5,null],[13,"Size","","Indicates that an endpoint is terminating the connection\nbecause it has received a message that is too big for it to\nprocess.",5,null],[13,"Extension","","Indicates that an endpoint (client) is terminating the\nconnection because it has expected the server to negotiate one or\nmore extension, but the server didn't return them in the response\nmessage of the WebSocket handshake. The list of extensions that\nare needed should be given as the reason for closing.\nNote that this status code is not used by the server, because it\ncan fail the WebSocket handshake instead.",5,null],[13,"Error","","Indicates that a server is terminating the connection because\nit encountered an unexpected condition that prevented it from\nfulfilling the request.",5,null],[13,"Restart","","Indicates that the server is restarting. A client may choose to reconnect,\nand if it does, it should use a randomized delay of 5-30 seconds between attempts.",5,null],[13,"Again","","Indicates that the server is overloaded and the client should either connect\nto a different IP (when multiple targets exist), or reconnect to the same IP\nwhen a user has performed an action.",5,null],[5,"listen","","A utility function for setting up a WebSocket server.",null,{"inputs":[{"name":"a"},{"name":"f"}],"output":{"name":"result"}}],[5,"connect","","A utility function for setting up a WebSocket client.",null,{"inputs":[{"name":"u"},{"name":"f"}],"output":{"name":"result"}}],[11,"fmt","","",3,null],[11,"new","","",0,{"inputs":[{"name":"kind"},{"name":"i"}],"output":{"name":"error"}}],[11,"into_box","","",0,null],[11,"fmt","","",0,null],[11,"fmt","","",0,null],[11,"description","","",0,null],[11,"cause","","",0,null],[11,"from","","",0,{"inputs":[{"name":"error"}],"output":{"name":"error"}}],[11,"from","","",0,{"inputs":[{"name":"error"}],"output":{"name":"error"}}],[11,"from","","",0,{"inputs":[{"name":"notifyerror"}],"output":{"name":"error"}}],[11,"from","","",0,{"inputs":[{"name":"utf8error"}],"output":{"name":"error"}}],[11,"from","","",0,{"inputs":[{"name":"box"}],"output":{"name":"error"}}],[11,"clone","","",4,null],[11,"eq","","",4,null],[11,"ne","","",4,null],[11,"fmt","","",4,null],[11,"text","","Create a new text WebSocket message from a stringable.",4,{"inputs":[{"name":"s"}],"output":{"name":"message"}}],[11,"binary","","Create a new binary WebSocket message by converting to Vec<u8>.",4,{"inputs":[{"name":"b"}],"output":{"name":"message"}}],[11,"is_text","","Indicates whether a message is a text message.",4,null],[11,"is_binary","","Indicates whether a message is a binary message.",4,null],[11,"len","","Get the length of the WebSocket message.",4,null],[11,"is_empty","","Returns true if the WebSocket message has no content.\nFor example, if the other side of the connection sent an empty string.",4,null],[11,"into_data","","Consume the WebSocket and return it as binary data.",4,null],[11,"into_text","","Attempt to consume the WebSocket message and convert it to a String.",4,null],[11,"as_text","","Attempt to get a &str from the WebSocket message,\nthis will try to convert binary data to utf8.",4,null],[11,"from","","",4,{"inputs":[{"name":"string"}],"output":{"name":"message"}}],[11,"from","","",4,{"inputs":[{"name":"str"}],"output":{"name":"message"}}],[11,"from","","",4,null],[11,"fmt","","",4,null],[11,"fmt","","",1,null],[11,"new","","",1,{"inputs":[{"name":"request"},{"name":"response"}],"output":{"name":"handshake"}}],[11,"remote_addr","","Get the IP address of the remote connection.",1,null],[11,"default","","",1,{"inputs":[],"output":{"name":"handshake"}}],[11,"fmt","","",6,null],[11,"origin","","Get the origin of the request if it comes from a browser.",6,null],[11,"key","","Get the WebSocket key sent in the request.",6,null],[11,"version","","Get the WebSocket protocol version from the request (should be 13).",6,null],[11,"resource","","Get the path of the request.",6,null],[11,"protocols","","Get the possible protocols the other endpoint supports.",6,null],[11,"extensions","","Get the extensions that the other endpoint is trying to negotiate.",6,null],[11,"headers","","Access the request headers as a vector of tuples.",6,null],[11,"client_addr","","Get the IP address of the client.",6,null],[11,"default","","",6,{"inputs":[],"output":{"name":"request"}}],[11,"fmt","","",7,null],[11,"status","","Get the status of the response",7,null],[11,"key","","Get the hashed WebSocket key",7,null],[11,"protocol","","Get the protocol that the server has decided to use",7,null],[11,"extensions","","Get the extensions that the server has decided to use. If these are unacceptable, it is\nappropriate to send an Extension close code",7,null],[11,"default","","",7,{"inputs":[],"output":{"name":"response"}}],[11,"clone","","",5,null],[11,"eq","","",5,null],[11,"ne","","",5,null],[11,"fmt","","",5,null],[11,"into","","",5,null],[11,"from","","",5,{"inputs":[{"name":"u16"}],"output":{"name":"closecode"}}],[11,"clone","","",8,null],[11,"fmt","","",8,null],[11,"token","","A Token identifying this sender within the WebSocket.",8,null],[11,"send","","Send a message over the connection.",8,null],[11,"broadcast","","Send a message to the endpoints of all connections.",8,null],[11,"close","","Send a close code to the other endpoint.",8,null],[11,"close_with_reason","","Send a close code and provide a descriptive reason for closing.",8,null],[11,"ping","","Send a ping to the other endpoint with the given test data.",8,null],[11,"pong","","Send a pong to the other endpoint responding with the given test data.",8,null],[11,"connect","","Queue a new connection on this WebSocket to the specified URL.",8,null],[11,"shutdown","","Request that all connections terminate and that the WebSocket stop running.",8,null],[6,"Result","","",null,null],[8,"Factory","","A trait for creating new WebSocket handlers.",null,null],[16,"Handler","","",9,null],[10,"connection_made","","Called when a TCP connection is made",9,null],[11,"on_shutdown","","",9,null],[8,"Handler","","The core trait of this library.\nImplementing this trait provides the business logic of the WebSocket application.",null,null],[11,"on_shutdown","","Called when a request to shutdown all connections has been received.",10,null],[11,"on_open","","Called when the WebSocket handshake is successful and the connection is open for sending\nand receiving messages.",10,null],[11,"on_message","","Called on incoming messages.",10,null],[11,"on_close","","Called when the other endpoint is asking to close the connection.",10,null],[11,"on_error","","Called when an error occurs on the WebSocket.",10,null],[11,"on_request","","A method for handling the low-level workings of the request portion of the WebSocket\nhandshake. Implementors can inspect the Request and select an appropriate string protocol\nand/or extensions to be used. This method will not be called when the handler represents\na client endpoint.",10,null],[11,"on_response","","A method for handling the low-level workings of the response portion of the WebSocket\nhandshake. Implementors can inspect the Response and choose to faile the connection by\nreturning an error. This method will not be called when the handler represents a server\nendpoint.",10,null],[11,"on_ping_frame","","",10,null],[11,"on_pong_frame","","",10,null],[11,"on_close_frame","","",10,null],[11,"on_binary_frame","","",10,null],[11,"on_text_frame","","",10,null],[11,"on_fragmented_frame","","",10,null],[11,"clone","","",2,null],[11,"fmt","","",2,null],[11,"default","","",2,{"inputs":[],"output":{"name":"settings"}}],[11,"new","","Create a new WebSocket using the given Factory to create handlers.",11,{"inputs":[{"name":"f"}],"output":{"name":"result"}}],[11,"with_config","","Create a new WebSocket with a Factory and use the event loop config to\nconfigure the event loop.",11,{"inputs":[{"name":"f"},{"name":"eventloopconfig"}],"output":{"name":"result"}}],[11,"listen","","Consume the WebSocket and listen for new connections on the specified address.",11,null],[11,"connect","","Queue an outgoing connection on this WebSocket. This method may be called multiple times,\nbut the actuall connections will not be established until after `run` is called.",11,null],[11,"run","","Run the WebSocket. This will run the encapsulated event loop blocking until the WebSocket\nis shutdown.",11,null],[11,"broadcaster","","Get a Sender that can be used to send messages on all connections.\nCalling `send` on this Sender is equivalent to calling `broadcast`.\nCalling `shutdown` on this Sender will shudown the WebSocket even if no connections have\nbeen established.",11,null],[11,"fmt","","",12,null],[11,"new","","Create a new Builder with default settings.",12,{"inputs":[],"output":{"name":"builder"}}],[11,"build","","Build a WebSocket using this builder and a factory.\nIt is possible to use the same builder to create multiple WebSockets.",12,null],[11,"with_config","","Set the EventLoopConfig to use with this WebSocket. If this is not set\nthe builder will use a default EventLoopConfig based on other settings.",12,null],[11,"with_settings","","Set the WebSocket settings to use.",12,null],[11,"on_shutdown","","",9,null],[11,"on_shutdown","","Called when a request to shutdown all connections has been received.",10,null],[11,"on_open","","Called when the WebSocket handshake is successful and the connection is open for sending\nand receiving messages.",10,null],[11,"on_message","","Called on incoming messages.",10,null],[11,"on_close","","Called when the other endpoint is asking to close the connection.",10,null],[11,"on_error","","Called when an error occurs on the WebSocket.",10,null],[11,"on_request","","A method for handling the low-level workings of the request portion of the WebSocket\nhandshake. Implementors can inspect the Request and select an appropriate string protocol\nand/or extensions to be used. This method will not be called when the handler represents\na client endpoint.",10,null],[11,"on_response","","A method for handling the low-level workings of the response portion of the WebSocket\nhandshake. Implementors can inspect the Response and choose to faile the connection by\nreturning an error. This method will not be called when the handler represents a server\nendpoint.",10,null],[11,"on_ping_frame","","",10,null],[11,"on_pong_frame","","",10,null],[11,"on_close_frame","","",10,null],[11,"on_binary_frame","","",10,null],[11,"on_text_frame","","",10,null],[11,"on_fragmented_frame","","",10,null]],"paths":[[3,"Error"],[3,"Handshake"],[3,"Settings"],[4,"ErrorKind"],[4,"Message"],[4,"CloseCode"],[3,"Request"],[3,"Response"],[3,"Sender"],[8,"Factory"],[8,"Handler"],[3,"WebSocket"],[3,"Builder"]]}; initSearch(searchIndex);