Skip to content

resocket/socket

Repository files navigation

Socket: A Better Reconnecting WebSocket

Socket logo

Socket is an open-source, developer-friendly reconnecting WebSocket library for JavaScript, designed to enhance your development experience (DX).

Key Features:

  • Authentication and Dynamic URL support
  • Built-in APIs for Connection Status and Lost Connection handling
  • Easy configuration for Heartbeats (PING/PONG)
  • Listens to Network and Focus events (configurable)
  • Flexible Stop Retry options for managing reconnections
  • Customizable Reconnection Delays
  • Buffering support during offline periods

Documentation

You can find the documentation for Socket here.

Motivation

Hi, I’m Ace, currently working on a next-gen multiplayer framework for real-time and collaborative apps. My mission is to greatly improve the developer experience (DevEx) for creating multiplayer and real-time applications, and this is my first release!

Reconnecting WebSockets are challenging—getting them right is even harder. Adding features like heartbeats and other complexities makes it even more error-prone. Throughout my career, I've seen countless reconnecting WebSocket implementations that work, but often have edge case bugs and race conditions. Even the best ones aren't immune (like the Liveblocks WebSocket bug I discovered and helped fix: issue & PR).

With this project, I aim to provide the community with a DevEx-focused reconnecting WebSocket library that simplifies everything. And if bugs or edge cases are found, they’ll be fixed—for everyone.

If you’re interested in trying out a new framework, join our Discord for early access. I’m also looking for early adopters. To set expectations, it’ll likely be open-source but behind a paid license for commercial usage (maybe ^^).

Stay Connected

If you find Socket useful, please consider starring this repository on GitHub! Your support helps others discover the project.

You can also follow me on Twitter @_shibru_ for updates and feel free to share this project with your network. Let’s make real-time web development smoother together!

Acknowledgements

This project takes inspiration from some of my past works reconnecting websocket (counter machine pattern) & partyworks's implementation. and the APIs are also hugely inspired by liveblocks (it's a team whose work I respect and admire alot). also thankx to @threepointone for sponsoring this in the past.

Resocket ~ Ace

About

a better reconnecting websocket library for everyone.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published