socketio / socket.io-chat-platform

A basic chat platform based on Socket.IO
https://socket.io
MIT License
89 stars 27 forks source link

RFC: create a package #3

Open darrachequesne opened 10 months ago

darrachequesne commented 10 months ago

Question: would it make sense to create a package from this? Something like:

import { Server } from "socket.io";
import pg from "pg";
import { initNamespace } from "@socket.io/chat-platform";
import { createAdapter } from "@socket.io/chat-platform-postgresql";

const io = new Server();
const pgPool = new pg.Pool();

initNamespace(io, {
  namespaceName: "/chat",
  adapter: createAdapter(pgPool),
});

The initNamespace() method would handle the basic plumbing:

Thoughts?