Skip to content

TencentEdgeOne/pages-websocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pages WebSocket

A WebSocket demo application for EdgeOne Pages, featuring echo messaging, latency testing, heartbeat keep-alive, and auto reconnection.

Deploy

Deploy with EdgeOne Pages

More Templates: EdgeOne Pages

Project Setup

npm install

Project Structure

├── index.html                 # Main HTML page
├── client.js                  # Client-side WebSocket logic
└── node-functions/
    └── websocket.ts           # Server-side WebSocket handler

WebSocket Protocol

All messages use JSON format: { "type": "<type>", "data": "<payload>" }

Type Direction Description
ready Server → Client Connection established
ping Client → Server Latency test request
pong Server → Client Latency test response
echo Bidirectional Echo message back
heartbeat Client → Server Keep-alive signal

About

pages websocket example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors