#WebSocket HttpHeader issues

1 messages · Page 1 of 1 (latest)

halcyon marlin
#

Hi, for some reason @minecraft/server-net you can pass a HttpHeader in the websocket.connect()

so when I do it:

    new HttpHeader("Authorization", "j")
  ]);``` 

 it throws up an error: ```[2026-05-29 17:43:05:650 ERROR] [Scripting] [New Project] Unhandled promise rejection: TypeError: Incorrect number of arguments to function. Expected 1, received 2    at setup (main.js:15)```  
 based on the error saying you can't pass in a HttpHeader but, in the docs says you can: ```export class WebSocket {
    private constructor();
    /**
     * @remarks
     * Attempts to connect a WebSocket client.
     *
     * This function can't be called in restricted-execution mode.
     *
     * @param uri
     * URL to make connection to.
     * @returns
     * An awaitable promise that contains the WebSocket client that
     * was connected.
     */
    connect(uri: string, headers?: HttpHeader[]): Promise<WebSocketClient>;
}

free to ping me : D thank you for your time

exotic meadow
#

Maybe the doc's version and your game's version are different

halcyon marlin
#

because my version is Version: 1.26.23.1

exotic meadow
exotic meadow
halcyon marlin
exotic meadow
#

Idk there's no docs for your specific games version, this is the closest I've found

npm i @minecraft/[email protected]

halcyon marlin
#

but the weird thing is

#

It's letting me run it in a non-Preview

#

websocket connection and I can send and receiving info

#

so I think Microsoft is just being weird about it lol

exotic meadow
#

Happen sometimes

halcyon marlin
# exotic meadow Happen sometimes

oh well is not a big deal. I can just wait until the update comes out can't be that long... Five years later, it finally came out lol

exotic meadow
#

They said the same about the chest ui