Created
          May 14, 2021 17:58 
        
      - 
      
 - 
        
Save amitrahav/c1a387028c4426d2dc63d29ce9c921f6 to your computer and use it in GitHub Desktop.  
    SocketVsSSE
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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