Install Asset
Install via Godot
To maintain one source of truth, Godot Asset Library is just a mirror of the old asset library so you can download directly on Godot via the integrated asset library browser
Quick Information
A GDScript Implementation of EventSource, a Web API available in Browsers and JavaScript for reading Server Sent Event Streams (SSE).It comes with exhaustive docs and implements the spec fully and is licensed under the MIT License.To contribute, raise issues or view the source code go to https://gitlab.com/DaGammla/godot-http-event-source
Godot HTTPEventSource for SSE
What is this?
This is a GDScript implementation of the of EventSource Web API available in Browsers and JavaScript for reading Server Sent Event Streams (SSE).
This implementation comes with exhaustive docs that you can view inside the Godot Editor by pressing F1
It completely implements the Spec, including Last-Event-ID and retry timeouts.
How to use
First add this plugin to your godot project into the res://addons/http_event_source
folder.
Then you can use the HTTPEventSource
class, very similar to how you would use the EventSource in JavaScript, except that you need to regularly call the HTTPEventSource.poll()
method to update the event stream.
To see how it fully works, its best to view the in-editor docs but here's a little example script on how to use it:
extends Node
var http_event_source: HTTPEventSource
func _ready() -> void:
http_event_source = HTTPEventSource.new()
http_event_source.connect_to_url("http://127.0.0.1:8080/test-sse")
http_event_source.event.connect(func(ev: ServerSentEvent):
print("-- TYPE --")
print(ev.type)
print("-- DATA --")
print(ev.data)
print("-- --\n")
)
func _process(delta: float) -> void:
http_event_source.poll()
Support
Please support me on Ko-fi if this helps you with your project.
And always remember to include the MIT LICENSE information when releasing your game to the public.
A GDScript Implementation of EventSource, a Web API available in Browsers and JavaScript for reading Server Sent Event Streams (SSE).
It comes with exhaustive docs and implements the spec fully and is licensed under the MIT License.
To contribute, raise issues or view the source code go to https://gitlab.com/DaGammla/godot-http-event-source
Reviews
Quick Information
A GDScript Implementation of EventSource, a Web API available in Browsers and JavaScript for reading Server Sent Event Streams (SSE).It comes with exhaustive docs and implements the spec fully and is licensed under the MIT License.To contribute, raise issues or view the source code go to https://gitlab.com/DaGammla/godot-http-event-source