-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Postgres adapter for socket communication #449
base: master
Are you sure you want to change the base?
Add Postgres adapter for socket communication #449
Conversation
✅ Tests will run for this PR. Once they succeed it can be merged. |
Please provide context about why this is needed and what purpose does it serve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like to know more about this before it gets merged
https://docs.nestjs.com/websockets/adapter |
CREATE TABLE IF NOT EXISTS socket_io_attachments ( | ||
id bigserial UNIQUE, | ||
created_at timestamptz DEFAULT NOW(), | ||
payload bytea | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tables normally should be created via schema.prisma
instead of at runtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know. I will change it, thanks!
If i correctly understood the socket.io adapter docs, this is only needed in cases when we want to emit messages across multiple server instances, which does not seem to be the case for us, at least for now. |
Since we have more than one server, we need this adapter as a way to notify all the servers of a specific event, so all the clients get notified.
For example, we receive a valid payment on only one server, and we need a way to notify all the users who might be connected to the other server.