Skip to content

Instantly share code, notes, and snippets.

@luciopaiva
luciopaiva / _Full-socketio-client-and-server-example.md
Last active April 27, 2024 04:09
Full socket.io client and server example

Full socket.io client and server example

Last updated: 2021-02-21, tested with socket.io v3.1.1

This is the simplest implementation you will find for a client/server WebSockets architecture using socket.io.

To see a full explanation, read my answer on SO here: https://stackoverflow.com/a/24232050/778272.

If you're looking for examples using frameworks, check these links:

@irrationalistic
irrationalistic / main.js
Created June 20, 2014 19:21
Coderbyte - Array Addition
function ArrayAddition(arr) {
// calculate the largest possible number
var startArr = arr.sort(function(a,b){return b-a});
var largest = startArr.shift();
// return true if the current total plus any number is
// the largest option
var checker = function(curArr, curTotal){
// Go through each item in the current set
@conorbuck
conorbuck / angle-between-points.js
Created May 5, 2012 22:51
JavaScript: Find the angle between two points
var p1 = {
x: 20,
y: 20
};
var p2 = {
x: 40,
y: 40
};