mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-29 18:39:14 -06:00
Socket
This is a shared lib for holding both the socket.io Cypress implements of the server and client.
Using
const socket = require("@packages/socket")
// server usage
const srv = require("http").createServer()
const io = new SocketIOServer(srv)
io.on("connection", function(){})
// client usage
const { client } = require("@packages/socket/browser/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