Update readme and the other thing
This commit is contained in:
parent
af26ff5dd5
commit
256ab53998
45
README.md
45
README.md
|
@ -1,2 +1,45 @@
|
|||
# Websocket Client for Roblox
|
||||
TODO: Detailed instructions on how to use this module will be added soon.
|
||||
|
||||
## Setup
|
||||
1. Place the WebSocket and Base64 files in ServerScriptService.
|
||||
2. Create a new script in Workspace, or wherever you want.
|
||||
3. If you are hosting your own WebSocket server, replace the URL `https://sock.kcadev.org` with your own.
|
||||
|
||||
## Usage
|
||||
```lua
|
||||
local ws = require(game.ServerScriptService:WaitForChild("WebSocket"))
|
||||
local server = ws({
|
||||
url = "wss://echo.websocket.org/",
|
||||
onMessage = function(message)
|
||||
print("Message received: " .. message)
|
||||
end,
|
||||
onError = function(error)
|
||||
print("Error: " .. error)
|
||||
end
|
||||
})
|
||||
server.sendMessage("Hello World")
|
||||
```
|
||||
|
||||
## Functions
|
||||
### ws
|
||||
```lua
|
||||
local server = ws({
|
||||
url = "wss://echo.websocket.org/",
|
||||
onMessage = function(message)
|
||||
print("Message received: " .. message)
|
||||
end,
|
||||
onError = function(error)
|
||||
print("Error: " .. error)
|
||||
end
|
||||
})
|
||||
```
|
||||
|
||||
### server.sendMessage
|
||||
```lua
|
||||
server.sendMessage("Hello World")
|
||||
```
|
||||
|
||||
### server.close
|
||||
```lua
|
||||
server.close()
|
||||
```
|
|
@ -1,7 +1,6 @@
|
|||
local Base64 = require(script.Base64)
|
||||
local Base64 = require(script.Parent:WaitForChild("Base64"))
|
||||
local JobId = game:GetService('HttpService'):GenerateGUID(false)
|
||||
local config = require(script.Parent.Parent:WaitForChild("Configuration"))
|
||||
local BaseUrl = config["websocket-proxy"]
|
||||
local BaseUrl = "https://sock.kcadev.org"
|
||||
local atob = Base64.atob
|
||||
local btoa = Base64.btoa
|
||||
local messages = {}
|
||||
|
|
Loading…
Reference in a new issue