Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Mar 15, 2024. It is now read-only.
/ssePublic archive

Server-Sent Events Example

License

NotificationsYou must be signed in to change notification settings

luixal/sse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

Server-Sent Events are a way of sending information from a server to its clients using just HTTP. Also, it has no dependencies for clients as all major browsers support it out of the box.

This repo contains some code projects showing example of how to work with it:

How do I run this?

You need to use at least two pieces for the example to work: a server and a client.

Server

First, you need to run the server, just get into thesse-server directory and install its dependencies:

npm i

then, just run the server:

npm start

you should see something like this:

SSE Example Server listening on 5001

that means that the server is running and listening for connections.

Clients

There are two similar clients that only differ in the front tooling used in each one. You just need to open in your brower theindex.html located in any of the client directories:sse-client/vue orsse-client/jquery and you should start seeing message.

Where do this messages come from?

Every 5 seconds, the server fetches a joke fromChuckNorris API and sends that joke as an SSE message to the clients.

Also, in the terminal you have opened your server, you can type some text and, when hittingenter, that text will be sent

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp