socket.io-client-yu

Socket.IO client Patch verion(0.9.16)

Usage no npm install needed!

<script type="module">
  import socketIoClientYu from 'https://cdn.skypack.dev/socket.io-client-yu';
</script>

README

socket.io-client-yu

修补版(Patch Version)

这是一个socket.io客户端程序,通过socket套接字基础上的简单实现。重新发布主要是为了解决官方的一个bug。修补方法来自伟大的google,为了方便发布完整修补版。

This is a socket.io client program, based on a simple socket socket implementation. Republish mainly to solve the official a bug.Repair method from the great google, in order to facilitate release of the complete version of the patch.

具体官方版本请查看:https://www.npmjs.com/package/socket.io-client

Specific official version, please see: https://www.npmjs.com/package/socket.io-client

目前代码是基于 socket.io-client 0.9.16版

At present code is based socket.io-client 0.9.16 version

修补后的使用(Use after repair)

var clientio = require('socket.io-client');

var socket = clientio.connect("http://127.0.0.1:3030/", {
    resource:'real',
    'connect timeout': 5000
});

console.log("start connect....");
socket.on('connect', function () {
    console.log("on connect ...");
});
socket.on('connect_error', function(error) {
    console.log("connect_error:", error);
});
socket.on('disconnect', function () {
    console.log("on disconnect ...");
});
socket.on('connect_failed', function(error) {
    // 修补后支持服务器发生任何错误时,捕获该错误
    // Support server when any error occurs after patching, the capture of the error
    console.log("connect failed:", error);
});
    
socket.on('connect_timeout', function() {
    console.log("connect timeout:");
});