Skip to content
Repos

DevPlaceApp

C++ 851 B23 lines Opens in site

Directory Raw Download

#pragma once
// Spec: models.md "Chat websocket", shell.md "Sockets". Frame type names, backoff and close codes.
namespace dp::spec {

struct ChatFrames {
  static constexpr const char* kServerReady = "ready";
  static constexpr const char* kServerMessage = "message";
  static constexpr const char* kServerTyping = "typing";
  static constexpr const char* kServerRead = "read";
  static constexpr const char* kServerError = "error";
  static constexpr const char* kClientSend = "send";
  static constexpr const char* kClientTyping = "typing";
  static constexpr const char* kClientRead = "read";
};

struct ChatSocketTiming {
  static constexpr int kBackoffInitialMs = 200;
  static constexpr int kBackoffMaxMs = 5000;
  static constexpr int kCloseCodeReconnectFast = 4013;
  static constexpr int kFastReconnectMs = 200;
};

}  // namespace dp::spec
22.2ms