Skip to content

A small decorator for the cocos-creator WebSocket API that automatically reconnects.

License

Notifications You must be signed in to change notification settings

HuMoran/cocos-websocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cocos-websocket

A small decorator for the cocos-creator WebSocket API that automatically reconnects.

eg:

const ReWebSocket = require('./websocket');
ws = new ReWebSocket('ws://xxxx');
ws.onopen = () => {
  console.log('websocket open');
  ws.send('hello server');
};
ws.onclose = () => {
  console.log('websocket closed');
};
ws.onmessage = (event) => {
  console.log('received msg', event.data);
};

About

A small decorator for the cocos-creator WebSocket API that automatically reconnects.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published