feldim2425 8 Posted April 17, 2017 Share Posted April 17, 2017 A simpe API to connect to a Websocket Server / Endpoint Forgot to mention: This API requires a Internet Card and Lua 5.3 Example Code: local ws = require("websocket_client"); local event = require("event"); local cl = ws.create(function(ev ,var1) print(ev .. "->" .. var1) end); cl:connect("localhost", 12345, "/"); while true do local ev = {event.pull()}; if ev[1] == "interrupted" then cl:disconnect(); return; elseif ev[1] == "touch" then cl:send("HI"); end end Full API documentation here: https://github.com/feldim2425/OC-Programs/blob/master/websocket_client/API.md To download and install the API simply run this command: pastebin run xnXssAtH Quote Link to post Share on other sites
sigmasoldier 0 Posted October 30, 2017 Share Posted October 30, 2017 Looks cool! I'll give it a try later Quote Link to post Share on other sites
asd5201314 0 Posted March 19, 2021 Share Posted March 19, 2021 Oh!It's so good.How to use oc to open websocket instead of connecting as a client? Quote Link to post Share on other sites
BrisingrAerowing 12 Posted March 20, 2021 Share Posted March 20, 2021 That issue is because you have your CPU set to Lua 5.2. Take the CPU out of the computer and sneak-right-click with it in your hand to change it to Lua 5.3. Quote Link to post Share on other sites
asd5201314 0 Posted March 20, 2021 Share Posted March 20, 2021 12 hours ago, BrisingrAerowing said: The problem is because you set the CPU to Lua 5.2. Take the CPU out of the computer, and then right-click it to change it to Lua 5.3. Oh! Great. How to use oc to open websocket instead of connecting as a client? Quote Link to post Share on other sites
BrisingrAerowing 12 Posted March 23, 2021 Share Posted March 23, 2021 Not possible with this library, unfortunately. Websockets are rather complicated, so a server is likely not possible. Quote Link to post Share on other sites