function formatWebsocketMessage(type, payload) {
  const message = {
    type,
    payload,
  };
  return JSON.stringify(message);
}
@description Format a websocket message.
@param {string} type - The type of the websocket message.
@param {*} payload - The payload of the message.
@returns {string} Return websocket message in string.
@example
formatWebsocketMessage('message.new', { text: 'test' });