import {isServerAction, ServerAction} from "./ServerAction"; import {AppAction} from "./AppAction"; import {ClientAction, isClientAction} from "./ClientAction"; // Terminology: Messages are the data packets sent and received over the WebSocket connection. // Commands are the protocol laid on top of messages. // Actions are data objects that the client uses to communicate between parts of itself. // All commands are both messages and actions. // An action is a message if and only if it is a command. // A message is an action if and only if it is a command. export type NetworkAction = ServerAction | ClientAction; export function isNetworkAction(action: AppAction): action is NetworkAction { return isServerAction(action) || isClientAction(action) }