It is indeed possible to configure and test WebSockets in the Mews Demo environment.

Testing with credentials

The simplest way to test WebSocket connections would be to use a browser extension. However, the tool you use must comply with the authentication standards described in the Connector API.

Just as you will need a pair of Access and Client tokens to make various API calls to Mews, you will need the same to authenticate a WebSocket connection. The Client token corresponds to that of the generic "Are you ready to integrate with Mews?" integration in Mews Demo.

For the purposes of testing, you do NOT need to add a new integration. Instead, please use any pair of tokens listed in the Demo environment section of the Connector API documentation.

Then simply set up your WebSocket connection as needed. Note that while Mews provides the functionality, Stack Overflow and other publicly available platforms will be a much better resource for set up and troubleshooting.

Maintaining the connection

Mews recommends that the integration sends a WebSocket Ping request to Mews at regular intervals (e.g., every five minutes) to monitor the connection. If the Ping request fails, the integration interface should be restarted or try to re-establish a connection.

Types of event you can test

Depending on what the integration does, you may wish to test any of the four types of WebSocket events listed in the API Documentation.

Simply make any changes to the relevant items in Mews (e.g., reservation, space, rate price, etc.) in order to trigger an event.

What it looks like in the production environment

When your integration has been successfully certified with Mews Marketplace, you will receive one unique Client Token for your integration, for the production environment. This should be paired with the Access Token (which differs from property to property).

For each property that adds an integration to their Marketplace subscriptions, a new Access Token will be generated, and it is unique to the specific property. You can then use the pair of Access/Client tokens to establish a WebSocket connection between the property's Mews environment and your integration interface.

Testing without credentials

If you are mainly interested in the type and content of the WebSocket notification that will be generated by a particular event in Mews, you can test WebSockets without needing to configure a connection.

  • Go to dashboard and open the devs tools for Chrome (F12), click on "Network" and then select "WS". Reload the page if needed and you will see the WebSocket in the list:

  • Click on it and select the tab "Messages". From there you will be able to see all the WebSocket events:

  • When you make an action that triggers an event, you will see it listed there as "Type":"Events", and you can click on it to see the details for it (in this example you can see how the resource was changed to "Inspected"):

Having trouble?

If you are able to connect to the WebSocket but do not see any events coming in, simply make any action in the Mews demo hotel you are connected to, to trigger an event. E.g., create a reservation, check in a reservation, make a space as Inspected, etc.

Did this answer your question?