Skip to content

Handshake Failure Between WebGL Client → Proxy → PlayFab Multiplayer Server #9

@zohaibkurlybrackets-oss

Description

Summary

When using a custom proxy (hosted on a Hostinger VPS) to bypass browser mixed-content restrictions, the WebSocket handshake between a WebGL client and a PlayFab Multiplayer Server fails.
The proxy successfully upgrades the connection (101 response), but the server then rejects incoming data because Unity Transport expects UTP packet-formatted messages, while the proxy forwards raw WebSocket frames.

Setup / Context
Client

  • Unity WebGL build

  • Using Unity Transport locally, but switching to WebSocketTransport for WebGL

  • Hosted on itch.io (HTTPS)

Proxy

  • This repository: MultiplayerServerSecureWebsocket

  • Hosted on Hostinger VPS (Ubuntu)

  • Purpose:

To accept secure wss:// traffic from the browser → forward to PlayFab’s server, bypassing mixed-content restrictions.

Server

  • PlayFab Multiplayer Server Build

  • Using Unity Transport (not WebSocketTransport)

What Works

  • WebGL client connects to my secure proxy using wss:// and a Session ID.

  • Proxy successfully upgrades the request (HTTP 101 Switching Protocols).

  • Proxy forwards to the PlayFab game server.

  • First response from server is received.

The Problem

After the 101 upgrade:

❌ Handshake fails because:

  • WebSockets send raw binary frames

  • Unity Transport on the PlayFab server expects UTP packet structure
    (header + payload, not a raw WebSocket frame)

So the PlayFab game server discards the handshake and immediately disconnects.

Additional Issue
If I try to use Unity Transport on both client and server and bypass the mixed-content restrictions:

Invalid server address (https://game.kurlybrackets.com/)

Unity Transport does not support https:// or wss://.
It only supports UDP/TCP using ip:port, and browsers cannot use UDP/TCP directly → which is why I'm attempting this WebSocket proxy.

Reproduction Steps

  • Host the proxy from this repo on a VPS with a valid certificate

  • Deploy a Unity-based PlayFab Multiplayer Server using Unity Transport

  • Build Unity WebGL client

  • Use WebSocketTransport on WebGL to connect to proxy

  • Observe successful upgrade (101)

  • Observe handshake failure due to mismatched transport packet format

Expected Behavior

A way to:

Either properly frame packets so Unity Transport can read them,
OR

A documented approach to bridge WebSocket → UTP format for PlayFab

Actual Behavior

Proxy forwards raw WebSocket frames that the Unity Transport server cannot decode, causing handshake rejection.

Question(s) for Maintainers
1. Does this proxy support Unity Transport?

Unity Transport uses its own packet protocol.
The proxy appears to assume plain WebSocket frames → which cannot be parsed by UTP.

2. Is the intent of this repo to support Unity Transport servers?

If not, is there a recommended approach to WebSocket → UTP translation?

3. Is PlayFab planning to support WebSocketTransport for Multiplayer Servers?

This would instantly solve the WebGL secure-connection problem.

4. Do you have documentation on the expected handshake format that UTP requires?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions