Skip to content

Latest commit

 

History

History
41 lines (34 loc) · 2.27 KB

README.md

File metadata and controls

41 lines (34 loc) · 2.27 KB

NodeWebSockets

A plugin for Godot 4. It gives you two new nodes, a WebSocketServer and a WebSocketClient.

How to install

Using the AssetLib on Godot

  • Open the AssetLib tab on Godot and search "NodeWebSockets"
  • Install the NodeWebSockets plugin
  • Enable NodeWebSockets in Project -> Project Settings -> Plugins

Manual installation

  • Clone or download this repository
  • Copy the folder 'addons/nodewebsockets' in your 'res://addons/' folder
    • Preview folder
  • Enable SimpleGrassTextured in Project -> Project Settings -> Plugins

Upgrade from previous version

  • Close all your scenes

    Especially those in which there is some NodeWebSockets

  • Disable NodeWebSockets in Project -> Project Settings -> Plugins
  • Delete the folder 'addons/nodewebsockets' on your project
  • Install the new NodeWebSockets version
  • Enable NodeWebSockets in Project -> Project Settings -> Plugins
  • Reload Godot

How to create a basic server

  • Add a WebSocketServer node to your scene
    • Preview scene showing a WebSocketServer
  • Configure your server in the inspector, indicating at least a connection port and protocol (clients must connect using the same protocol, if no protocol is indicated, clients must not specify any protocol either)
    • Preview inspector showing basic setup server
  • Connect the server signals you need, for example "client_connected" and "text_received"
    • Preview server signals connected

How to create a basic client

  • Add a WebSocketClient node to your scene
    • Preview scene showing a WebSocketClient
  • Configure your client in the inspector, indicating the URL and port of the server with the following format ws://IP-ADDRESS:PORT, and the protocols to use (the server will select one of the protocols, if none is available on the server the connection will be closed)
    • Preview inspector showing basic setup client
  • Connect the client signals you need
    • Preview client signals connected