
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@foxglove/electron-socket
Advanced tools
Networking sockets for Electron apps
Raw sockets are not supported in browser contexts, even in Electron apps. To overcome this limitation, this package uses RPC between the Electron renderer context (referred to in this package as the "renderer" and in Electron documentation as "main world") and the preloader (referred to in Electron documentation as "isolated world" when running with contextIsolation: true) to expose TCP/UDP sockets and server classes in the renderer context. The API somewhat resembles net.Socket/dgram.Socket and net.Server from node.js, with Promise-based methods since these classes are built on asynchronous RPC.
// preload.ts ////////////////////////////////////////////////////////////////
import { PreloaderSockets } from "@foxglove/electron-socket/preloader";
PreloaderSockets.Create();
// renderer.ts ///////////////////////////////////////////////////////////////
import { Sockets } from "@foxglove/electron-socket/renderer";
async function main() {
const net = await Sockets.Create();
const server = await net.createServer();
server.on("connection", (client) => {
client.write(new Uint8Array([42]));
});
server.listen(9000);
const socket = await net.createSocket();
socket.on("data", (data: Uint8Array) => console.log(`Server sent ${data}`));
socket.connect({ port: 9000, host: "localhost" });
}
main();
@foxglove/electron-socket is licensed under the MIT License.
A small example Electron app is provided in the example directory, which can be used for manual testing. Run it using yarn example.
yarn version --[major|minor|patch] to bump versiongit push && git push --tags to push new tagJoin our Slack channel to ask questions, share feedback, and stay up to date on what our team is working on.
FAQs
Networking sockets for Electron apps
The npm package @foxglove/electron-socket receives a total of 1,506 weekly downloads. As such, @foxglove/electron-socket popularity was classified as popular.
We found that @foxglove/electron-socket demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.