Skip to content

Instantly share code, notes, and snippets.

@amitrahav
Created May 14, 2021 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitrahav/c1a387028c4426d2dc63d29ce9c921f6 to your computer and use it in GitHub Desktop.
Save amitrahav/c1a387028c4426d2dc63d29ce9c921f6 to your computer and use it in GitHub Desktop.
SocketVsSSE
const BASE_URL = "<https://localhost:8000/api/v1/>"; // My server base url
const SSE_REQUEST = "SSE_REQUEST"; // This will be the identifier for the middlware to process that request.
// All states of requests the reducers will need to know
const createSSERequestAction = (actionType) => ({
OPEN: `${actionType}_OPEN`,
CLOSE: `${actionType}_CLOSE`,
RECIVED: `${actionType}_RECIVED`,
FAILURE: `${actionType}_FAILURE`,
CONNECTING: `${actionType}_CONNECTING`,
BASE: actionType,
});
const SSEConstants = {
BASE_URL,
SSE_REQUEST,
createSSERequestAction,
};
export default SSEConstants;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment