Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

lua - Attempting to connect to a websocket returns "Attempt to call nil" in computer craft

I'm trying to connect to the twitch chat-irc websockets, but when I run my code to test, it returns .temp:7: attempt to call nil. I've heard that it has to do something with functions, but my code has no functions, only strings, and has only 2 other lines that connect to line 7. Anyone have an idea of how to fix this?

local Channel = *my channel*
local Name = *Bot account name*
local Pass = *oauth code*

local cum = "wss://irc-ws.chat.twitch.tv:443"

local ws = http.websocket(cum)
if ws then
        print("Connection Established")

websocket.send("PASS " ..Pass .."
")
websocket.send("NICK " ..Name .."
")
websocket.send("Join " ..Channel .."
")
question from:https://stackoverflow.com/questions/65849984/attempting-to-connect-to-a-websocket-returns-attempt-to-call-nil-in-computer-c

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...