mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-16 01:57:34 +00:00
ws auth
This commit is contained in:
parent
fad6411850
commit
9582b41b56
|
@ -2,12 +2,19 @@
|
||||||
// WebSocket
|
// WebSocket
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!GWSockets) then return gmInte.logError("GWSockets not found!") end
|
if (!gmInte.config.websocket) then return end
|
||||||
|
|
||||||
require("gwsockets")
|
require("gwsockets")
|
||||||
|
|
||||||
|
if (GWSockets) then return gmInte.logError("GWSockets is not installed! Please install it from https://github.com/FredyH/GWSockets") end
|
||||||
|
|
||||||
local socket = GWSockets.createWebSocket("wss://ws.gmod-integration.com")
|
local socket = GWSockets.createWebSocket("wss://ws.gmod-integration.com")
|
||||||
|
|
||||||
|
// Authentication
|
||||||
|
socket:setHeader("id", gmInte.config.id)
|
||||||
|
socket:setHeader("token", gmInte.config.token)
|
||||||
|
|
||||||
|
// Dev
|
||||||
function socket:onMessage(txt)
|
function socket:onMessage(txt)
|
||||||
print("Received: ", txt)
|
print("Received: ", txt)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user