Skip to content

ruiqbarbosa/react-server-sent-events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server-Sent Events (SSE) with node and react/react native

This project provides a simple example of using server-sent events in a client-server application. The server is implemented in express node js and the clients in react and react native.

The server exposes an endpoint which every five seconds sends the current time to the subscribed clients.

Demonstration

In both cases, browser and mobile, you can see the real time updating.

Mobile: SSE - Mobile

Browser: enter image description here

Installing

Clone the repository.

server

Install dependencies:

npm install

To run:

node index.js

Access from:

http://localhost:3001/

client_react

Install dependencies:

npm install

To run:

npm start

Access from:

http://localhost:3000/

client_reactNative

You should have expo installed. For Installing dependencies:

npm install

To run:

expo start

About

Server-Sent Events (SSE) with node and react/react native

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published