aws4
aws4 copied to clipboard
Sign WebSocket request
Hello,
Is there any options to sign a WebSocket request (for API Gateway WebSocket API) ?
Any update on this?
@mhart I am wondering if I can sign WebSocket Request through this aws4 sign library ?
Yes there is!
aws4.sign({
host: 'XXX.execute-api.XXX.amazonaws.com',
path: '/XXX,
signQuery: true,
}, {
accessKeyId: 'XXX',
secretAccessKey: 'XXX',
sessionToken: 'XXX',
})
let socket = new WebSocket("wss://" + signedUrl.host + signedUrl.path)
socket.onopen = function() {
console.log('CONNECTED')
}