Skip to content

Instantly share code, notes, and snippets.

@Haris-Nr
Haris-Nr / socket_io_cheat
Created December 30, 2023 20:19 — forked from arthuribik/socket_io_cheat
Socket.io cheat sheet
//sending to sender-client only
socket.emit('message', "this is a test");
//sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender
socket.broadcast.to('game').emit('message', 'nice game');
// sending to sender client, only if they are in 'game' room(channel)
@Haris-Nr
Haris-Nr / socket-cheatsheet.js
Created December 30, 2023 20:19 — forked from alexpchin/socket-cheatsheet.js
A quick cheatsheet for socket.io
// sending to sender-client only
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.emit('message', "this is a test");
// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Create Free AWS Account

Create free AWS Account at https://aws.amazon.com/

2. Create and Lauch an EC2 instance and SSH into machine

I would be creating a t2.medium ubuntu machine for this demo.

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Create Free AWS Account

Create free AWS Account at https://aws.amazon.com/

2. Create and Lauch an EC2 instance and SSH into machine

I would be creating a t2.medium ubuntu machine for this demo.

@Haris-Nr
Haris-Nr / install_nginx.md
Created September 12, 2023 08:12 — forked from piyushgarg-dev/install_nginx.md
Nginx Installation