How might I connect to Minecraft from Snap?

Ok what‽ I searched "make wsserver for minecraft bedrock" and this is on the second page.

Not for me. Must be google tracking you

DuckDuckGo FTW!

I use Bing on Edge, really because that's all I have. (I'd really like to get Firefox, but my computer can't write to its long-term memory, so I'm not sure it'll install right.)

I use duckduckgo/google in brave. I don't really mind google using my search history to target me with ads, mainly because brave already blocks ads...

Anyways, like I said, Serial Ports are more for Microcontroller programming rather than making Online Servers or other stuff.

I think you are getting confused about the word "Serial" and "Port". You see, a "Port" can be the side of an object like the ISS or a ship, can be an Online Port which connects you to an online server, and a Port as in a Microcontroller port.

"Serial" can be an ID number for a product, a term used online, or a term used in Microcontroller programming.

In this case, both words are terms of Microcontroller programming.

I'm not going to use Serial Ports; all I need is to make a working websocket server that I can connect to with Minecraft.

You'd need repl.it to do something like that. Snap! is mostly for coding simple things.

I am using replit. I now have this, but I'm not sure what to do to make it send stuff to MC.

Also:

Failed to open a WebSocket connection: empty Connection header.

Try running the script on your computer instead of in replit. You might get better results.

Also, to connect the server to minecraft, use the /connect command with the link to the server as the argument (you do need cheats enabled thogh).

I also found this

edit: just ran your script on my computer, and yes, the server started, only problem was, minecraft couldn't connect to it.

I can't:

So I can't make a Python program on my computer, not to mention I can't run it because I don't even have Python anymore because I had to reinstall Windows before finding out that the corruption happening is actually due to the hard drive not being able to write. (That's probably the longest sentence I've ever written.)

Aka /wsserver.

Exactly! I can't get Minecraft to connect.

Why?

What URL are you using?

Well it is "no ceiling..."

The hard drive is messed up, and apparently the only symptom is the computer not being able to write to its long-term memory.

I've tried all sorts of things:

  • 0.0.0.0:5051
  • https://<name of the repl>.warpedwartwars.repl.co
  • https://<name of the repl>.warpedwartwars.repl.co:5051
  • ws://<name of the repl>.warpedwartwars.repl.co
  • ws://<name of the repl>.warpedwartwars.repl.co:5051
  • and others.

I've made a new repl here, forked from this github repo linked to by this, and I still can't get it to work.

I can get it to work, in fact, I'm able to connect it to minecraft. All you need to do is have it on your computer instead of replit. I don't know how to set it up so it'll work in replit.

Are you using the mineserver2.py file? That's what I'm using right now.

It looks like this in the repl:

import asyncio
import websockets
import json
from uuid import uuid4

host = "0.0.0.0"
port = 3000

async def mineproxy(websocket, path):
    print('Connected')
    await websocket.send(
        json.dumps({
            "header": {
                "version": 1,
                "requestId": str(uuid4()),
                "messageType": "commandRequest",
                "messagePurpose": "subscribe"
            },
            "body": {
                "eventName": "PlayerMessage"
            },
        }))

    try:
        async for msg in websocket:
            msg = json.loads(msg)
            print(msg)
    except websockets.exceptions.ConnectionClosedError:
        print('Disconnected from Minecraft')


start_server = websockets.serve(mineproxy, host=host, port=port)
print(f'Ready. On Minecraft, type /connect {host}:{port}')

asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()

I ran all 3 files.

Try wss://<name of the repl>.warpedwartwars.repl.co

How so? If it can't write to the long-term memory, what happens to the browser cache, cookies, and other things?

Ok, I'll try that and it:<the port> as well.

Edit: Nope.

IDK. It seems to be very specific:

  • Programs I install stay
  • Text and image files I make aren't written right
  • Files made by, say, Minecraft, stay
  • Browser stuff stays
  • Downloaded files usually aren't written right

when I tried that on my forked repo, minecraft said, connection closed.