Skip to content

vamsib/mountebank-ws

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

mountebank-ws

This is a web socket plugin for Mountebank.

Modelling different web socket scenarios

Request-Response

Client sends a request message and server sends a response message

{
  "predicates": [
    {
      "equals": {
        "message": "foo"
      }
    }
  ],
  "responses": [
    {
      "is": "bar"
    }
  ]
}

Request-Stream response

Client sends a request (subscribe). Server starts streaming responses. Client can also unsubscribe.

{
  "predicates": [
    {
      "equals": {
        "message": "start_ticker"
      }
    }
  ],
  "responses": [
    {
      "is": {
        "__MB_CUSTOM_RESPONSE": {
          "command": "start_stream",
          "source": "random_price",
          "interval": 1000,
          "id": "price"
        }
      }
    }
  ]
}
{
  "predicates": [
    {
      "equals": {
        "message": "stop_ticker"
      }
    }
  ],
  "responses": [
    {
      "is": {
        "__MB_CUSTOM_RESPONSE": {
          "command": "stop_stream",
          "id": "price"
        }
      }
    }
  ]
}

Acknowledgements

Thanks to Max Ludwig. LDAP plugin implementation was a great help for me to get started.

License

This project is licensed under the MIT License - see the LICENSE file for details

About

Websocket plugin for Mountebank

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published