websocket-url

0.0.2 • Public • Published

browser support

websocket-url

This is a URL parser specifically designed for a WebSocket client and enforces the rules of the WebSocket specification.

html5 websocket parsing

http://dev.w3.org/html5/websockets/#parsing-websocket-urls

api

    var URL = require('websocket-url')
    var url = URL.parse('ws://websocket.org/echo?test')
    // url = {
    //         host:     'websocket.org',
    //         port:     '80',
    //         resource: '/echo?test',
    //         secure:   false
    //       }

throws

The parse function throws an error in the following situations

  • the url string is not an absolute URL
  • the scheme is not "ws" or "wss"
  • there is a fragment in the URL

LICENSE

MIT

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i websocket-url

    Weekly Downloads

    4

    Version

    0.0.2

    License

    MIT

    Last publish

    Collaborators

    • supershabam