Skip to content

unisocket3/rblx-unisocket3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

rblx-unisocket3

WebSocket for ROBLOX.

Usage

local ws = require(path.to.your.script)
local server = ws({
	url = "wss://your-websocket-endpoint.here"
})
server.sendMessage("Hello World")

How to use for Roblox game?

First, copy all the files from the "lua" folder to ServerScriptService. (Do not run the server unless you want to use your own, which in that case, replace the URL "https://unisock.seven7four4.repl.co" with whatever port you set it on.)

Then, accept HTTP requests on your game, and create a new script (NOT LOCAL) in Workspace, or wherever you want.

Now, paste this in, and replace "your-websocket-endpoint.here" with the URL to your WebSocket server, and "Hello World" with whatever message you would like to send to your WebSocket server.

local ws = require(game.ServerScriptService.WebSocket)
local server = ws({
	url = "wss://your-websocket-endpoint.here"
})
server.sendMessage("Hello World")

You can also run a function every time a message is recieved, like this:

local ws = require(game.ServerScriptService.WebSocket)
local server = ws({
	url = "wss://your-websocket-endpoint.here",
	onMessage = function(message)
		print(message)
	end
})
server.sendMessage("Hello World")

About

WebSocket for ROBLOX.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published