I hereby claim:
- I am melontron on github.
- I am melontron (https://keybase.io/melontron) on keybase.
- I have a public key ASAVjhcKGNqJq4xgMO-7y2a5s4q6uCbaG6bIlolFyjIs7Ao
To claim this, I am signing this object:
են | |
Են | |
որ | |
Որ | |
եւ | |
Եւ | |
այն | |
Այն | |
միայն | |
Միայն |
function decorate(object_path, method, pos='after', obj) { | |
const chain = object_path.split('.'); | |
let object = obj || this; | |
for (let i =0; i < chain.length - 1; i++) { | |
if (!object[chain[i]]) throw new Error(`Invalid decoration ${object_path}`); | |
object = object[chain[i]]; | |
} | |
if ('before' === pos) { |
I hereby claim:
To claim this, I am signing this object:
resource "aws_security_group" "nat" { | |
name = "${var.env}-${var.project}-vpc-nat-sg" | |
description = "Allow traffic to pass from the private subnet to the internet" | |
ingress { | |
from_port = 0 | |
to_port = 65535 | |
protocol = "tcp" | |
cidr_blocks = "${var.private_subnet_cidrs}" | |
} |
output "vpc_id" { | |
value = "${aws_vpc.default.id}" | |
} | |
output "public_subnets" { | |
value = ["${aws_subnet.us-east-1a-public.id}","${aws_subnet.us-east-1b-public.id}"] | |
} | |
output "private_subnets" { | |
value = ["${aws_subnet.us-east-1a-private.id}","${aws_subnet.us-east-1b-private.id}"] |
const WebSocket = require('ws'); | |
const ws = new WebSocket('ws://localhost:8080/path',["my-custom-subprotocol"], { | |
headers: {token: "some_super_secret_token"} | |
}); | |
ws.on('open', function open() { | |
ws.send('something ' + Math.random()); | |
}); |
let WebSocketServer = require('ws').Server; | |
let wss = new WebSocketServer({ | |
verifyClient: function (info, cb) { | |
let token = info.req.headers.token; | |
if (!token) | |
cb(false, 401, 'Unauthorized'); | |
else { | |
// here should be your authorization logic |
The handshake from the client looks as follows: | |
GET /chat HTTP/1.1 | |
Host: server.example.com | |
Upgrade: websocket | |
Connection: Upgrade | |
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== | |
Origin: http://example.com | |
Sec-WebSocket-Protocol: chat, superchat | |
Sec-WebSocket-Version: 13 |
const WebSocket = require('ws'); | |
const ws = new WebSocket('ws://username@localhost:8080/path', { | |
headers: {token: "melo"} | |
}); | |
ws.on('open', function open() { | |
ws.send('something ' + Math.random()); | |
}); |