Files
cypress/packages/socket
Zach Bloomquist d01932bf75 fix: retry on EMFILE always, lint sync FS calls (#22175)
* fix: use graceful-fs always, warn in development on sync calls

* skip prop linting in some dirs

* eslint rules

* use AST-based lint rule instead

* comment

* ignore existsSync

* run without nextTick

* remove dev warning code

* fix order

* register TS first

* fix tests

* fix test

* cover new call site

* fix new test
2022-06-16 14:35:31 +10:00
..

Socket

This is a shared lib for holding both the socket.io server and client.

Using

const socket = require("@packages/socket")

// returns
{
  server: require("socket.io"),
  getPathToClientSource: function () {
    // returns path to the client 'socket.io.js' file
    // for use in the browser
  }
}
const socket = require("@packages/socket")

// server usage
const srv = require("http").createServer()
const io = socket.server(srv)
io.on("connection", function(){})

// client usage
const { client } = require("@packages/socket/lib/client")
const client = socket.client("http://localhost:2020")
client.on("connect", function(){})
client.on("event", function(){})
client.on("disconnect", function(){})

// path usage
socket.getPathToClientSource()
// returns your/path/to/node_modules/socket.io-client/socket.io.js0

Testing

yarn workspace @packages/socket test