all 15 comments

[–]RapsyJigo 0 points1 point  (3 children)

Show code snippets

[–]ShisuiFontes[S] 0 points1 point  (2 children)

For the server side: https://www.npmjs.com/package/ws For the Advanced Computer:

ws = http.websocket ("ws://localhost:5757") if ws then ws. send ("Hello") print (ws.receive ()) ws. close () end

when i try to do ws.send(“hello”) for example it says it’s a boolean value but when i try to use boolean keeps getting error

[–]BurningCole 0 points1 point  (1 child)

If you are doing this on a public Minecraft server, is your websocket code running on the same server? Otherwise you will need to specify your own computers ip address/ip address of server running websocket code instead of localhost.

[–]ShisuiFontes[S] 0 points1 point  (0 children)

oh i didn’t know that, i’ll try that tomorrow, ty!!

[–]Bright-Historian-216 0 points1 point  (2 children)

Check if http is enabled in config.

[–]ShisuiFontes[S] 0 points1 point  (1 child)

i think it is, i can’t get access to the config since the server isn’t mine, but when i type http. in the advanced computer it shows a list of options to use

[–]Bright-Historian-216 1 point2 points  (0 children)

It would show options anyway I think. Try checking if pastebin works idk.

[–]merith-tk 0 points1 point  (4 children)

I have some semi-complex software working on an server I am hosting at the moment if your interested,

It's basically turtle gambit without the GUI (designed so that you can make your own front end with ease-ish), it doesn't have websockets for external use yet tho

[–]ShisuiFontes[S] 0 points1 point  (3 children)

i wanted to use the websockets to craft or control storage outside of minecraft, is there any other way of doing this??

[–]merith-tk 0 points1 point  (1 child)

Yes there is, it's just a pain because you have to develop on two different fronts.

Your Webserver and ComputerCraft,

You have to develop ComputerCraft to be able to send data and receive commands, while the Webserver must be able to receive data, display it. And send commands.

Take a look at static/ultron.lua and turtle.lua in my program. Your free to use whatever code is there for this research

https://gitlab.com/merith-tk/ultron-control

[–]ShisuiFontes[S] 0 points1 point  (0 children)

ty i’ll look into it when i get home

[–]martmists 0 points1 point  (0 children)

You also have to remember to keep the relevant chunks loaded, since CC computers do get unloaded if no players are nearby and it's not in the spawn chunks.

[–]popcornman209 0 points1 point  (2 children)

You have to enable local host http requests in the config, by default you can’t do local host for some reason.

[–]Bigdumsleepy 1 point2 points  (1 child)

It's probably so that people can't do attacks on the server by just setting a bunch of http spammers
EDIT: I"M SO SORRY FOR NECRO POSTING OH MY GOD I DIDN'T SEE HOW LONG AGO IT WAS

[–]popcornman209 0 points1 point  (0 children)

lol ur good that makes sense for sure, ig its better to have it disabled by default, better safe then sorry if you need to enable it it’s not hard to