Home
Ratchet Library :: API Reference
API  ·  Manual

Module ratchet.uri

This module provides a parser for generic RFC 2396 URI strings. Some built-in schema parsers are included, such as "tcp", "udp", and "unix" which each return ratchet.socket objects. New URIs schemas may be registered.

Functions

parse (uri, ...) Parses a URI string and calls its handler.
register (schema, handler) This function registers a new schema to be handled by the given handler function.


Functions

parse (uri, ...)
Parses a URI string and calls its handler. The handler is passed the rest of the URI after the schema portion and the first ":" character, as well as any additional arguments sent to this function. Any values returned from the handler are passed on the caller of this function.

Parameters

  • uri: the URI string.
  • ...: additional parameters to send to the handler.

Return value:

any values returned by the handler are returned by this function.
register (schema, handler)
This function registers a new schema to be handled by the given handler function. The schema name can only include alpha-numeric characters and hyphens and must begin with an alpha-numeric character.

Parameters

  • schema: the schema name.
  • handler: the function to call when parsing a URI of this schema.