@@ -25,8 +25,8 @@ import { PusherProvider } from '@open-socket/provider-pusher';
2525const socket = await createOpenSocket ({
2626 provider: new PusherProvider ({
2727 key: ' your-pusher-key' ,
28- cluster: ' us2'
29- })
28+ cluster: ' us2' ,
29+ }),
3030});
3131
3232// Connect to the provider
@@ -36,29 +36,29 @@ await socket.connect();
3636const channel = socket .channel (' my-channel' );
3737
3838// Listen for messages
39- await channel .subscribe (' my-event' , ( message ) => {
39+ await channel .subscribe (' my-event' , message => {
4040 console .log (' Received:' , message .data );
4141});
4242
4343// Publish messages
44- await channel .publish (' my-event' , {
45- text: ' Hello, real-time world!'
44+ await channel .publish (' my-event' , {
45+ text: ' Hello, real-time world!' ,
4646});
4747```
4848
4949## 📦 Packages
5050
5151This monorepo contains the following packages:
5252
53- | Package | Description | Version |
54- | ---------| -------------| ---------|
55- | [ ` @open-socket/core ` ] ( ./packages/core ) | Core abstractions and interfaces | ![ npm] ( https://img.shields.io/npm/v/@open-socket/core ) |
53+ | Package | Description | Version |
54+ | -------------------------------------------------------- | ----------------------------------- | --------------------------------------------------------------- |
55+ | [ ` @open-socket/core ` ] ( ./packages/core ) | Core abstractions and interfaces | ![ npm] ( https://img.shields.io/npm/v/@open-socket/core ) |
5656| [ ` @open-socket/testing-utils ` ] ( ./packages/testing-utils ) | Testing utilities and mock provider | ![ npm] ( https://img.shields.io/npm/v/@open-socket/testing-utils ) |
5757
5858### Provider Packages (Coming Soon)
5959
6060- ` @open-socket/provider-pusher ` - Pusher adapter
61- - ` @open-socket/provider-ably ` - Ably adapter
61+ - ` @open-socket/provider-ably ` - Ably adapter
6262- ` @open-socket/provider-socketio ` - Socket.io adapter
6363
6464### Framework Packages (Coming Soon)
@@ -83,17 +83,17 @@ One of the key benefits of OpenSocket is the ability to switch providers easily:
8383``` typescript
8484// Using Pusher
8585const socket = await createOpenSocket ({
86- provider: new PusherProvider ({ key: ' pusher-key' })
86+ provider: new PusherProvider ({ key: ' pusher-key' }),
8787});
8888
8989// Switch to Ably (same API!)
9090const socket = await createOpenSocket ({
91- provider: new AblyProvider ({ key: ' ably-key' })
91+ provider: new AblyProvider ({ key: ' ably-key' }),
9292});
9393
9494// Switch to Socket.io (same API!)
9595const socket = await createOpenSocket ({
96- provider: new SocketIOProvider ({ url: ' http://localhost:3000' })
96+ provider: new SocketIOProvider ({ url: ' http://localhost:3000' }),
9797});
9898```
9999
@@ -155,14 +155,14 @@ pnpm format
155155
156156## 📊 Provider Feature Matrix
157157
158- | Feature | Pusher | Ably | Socket.io |
159- | ---------| -------- | ------| -----------|
160- | Public Channels | ✅ | ✅ | ✅ |
161- | Private Channels | ✅ | ✅ | ✅ |
162- | Presence | ✅ | ✅ | ✅ |
163- | Message History | ❌ | ✅ | ⚠️ |
164- | Binary Data | ❌ | ✅ | ✅ |
165- | Acknowledgments | ❌ | ✅ | ✅ |
158+ | Feature | Pusher | Ably | Socket.io |
159+ | ---------------- | ------ | ---- | --------- |
160+ | Public Channels | ✅ | ✅ | ✅ |
161+ | Private Channels | ✅ | ✅ | ✅ |
162+ | Presence | ✅ | ✅ | ✅ |
163+ | Message History | ❌ | ✅ | ⚠️ |
164+ | Binary Data | ❌ | ✅ | ✅ |
165+ | Acknowledgments | ❌ | ✅ | ✅ |
166166
167167## 🔌 Middleware
168168
@@ -171,15 +171,15 @@ Extend OpenSocket with custom middleware:
171171``` typescript
172172const loggingMiddleware = {
173173 name: ' logging' ,
174- pre : async ( context ) => {
174+ pre : async context => {
175175 console .log (' Before:' , context .operation );
176176 },
177- post : async ( context ) => {
177+ post : async context => {
178178 console .log (' After:' , context .operation );
179179 },
180180 error : async (error , context ) => {
181181 console .error (' Error:' , error );
182- }
182+ },
183183};
184184
185185socket .use (loggingMiddleware );
@@ -203,6 +203,7 @@ This project is licensed under the Apache License 2.0 - see the [LICENSE](./LICE
203203## 🙏 Acknowledgments
204204
205205OpenSocket is inspired by:
206+
206207- [ OpenFeature] ( https://openfeature.dev/ ) for the vendor-agnostic approach
207208- The real-time communication community
208209
@@ -215,4 +216,4 @@ OpenSocket is inspired by:
215216
216217---
217218
218- <p align =" center " >Built with ❤️ by the OpenSocket community</p >
219+ <p align =" center " >Built with ❤️ by the OpenSocket community</p >
0 commit comments