Skip to content

WebSocket client

A WebSocket client for fast client-server networking.

Authors and contributors to this experimental extension: (not specified).


This extension allows to use WebSocket based networking. You can use it to interact with a WebSocket based API, or a server for your multiplayer game.

Features:

  • Connection and disconnection from a server
  • Receiving strings from the server
  • Sending strings to the server
  • Error handling
  • Handling more than 1 event per frame

Doesn't contain:

  • Sending or receiving binary data
  • A WebSocket server

Tip

Learn how to install new extensions by following a step-by-step guide.

Actions

Connect to server
Connects to a WebSocket server.

See parameters
  • Parameter 1 (string): The server address

Technical note: parameters 0, 2 are internal parameters handled by GDevelop.

Disconnect from server
Disconnects from the current WebSocket server.

See parameters
  • Parameter 1 (string): The reason for disconnection

Technical note: parameters 0, 2 are internal parameters handled by GDevelop.

Mark as processed
Dismisses an event after processing it to allow processing the next one without waiting for the next frame.

See parameters

Technical note: parameters 0, 1 are internal parameters handled by GDevelop.

Send data to the server
Sends a string to the server.

See parameters
  • Parameter 1 (string): The data to send to the server

Technical note: parameters 0, 2 are internal parameters handled by GDevelop.

Conditions

An event was received
Triggers when the server has sent the client some data.

See parameters

Technical note: parameters 0, 1 are internal parameters handled by GDevelop.

Connection to a server was closed
Triggers if the connection to a WebSocket server was closed.

See parameters

Technical note: parameters 0, 1 are internal parameters handled by GDevelop.

Connected to a server
Triggers if the client is connected to a WebSocket server.

See parameters

Technical note: parameters 0, 1 are internal parameters handled by GDevelop.

Connecting to a server
Triggers if the client is currently connecting to the WebSocket server.

See parameters

Technical note: parameters 0, 1 are internal parameters handled by GDevelop.

An error occurred
Triggers when a WebSocket error has occurred.

See parameters

Technical note: parameters 0, 1 are internal parameters handled by GDevelop.

Expressions

Expression Description
WebSocketClient::Data() Returns the piece of data from the server that is currently being processed.
WebSocketClient::LastError() Gets the last error that occurred.

This page is an auto-generated reference page about the WebSocket client extension, made by the community of GDevelop, the open-source, cross-platform game engine designed for everyone. Learn more about all GDevelop community-made extensions here.