HTTPEventSource for Server Sent Events

An asset by DaGammla
The page banner background of a mountain and forest
HTTPEventSource for Server Sent Events hero image

Quick Information

0 ratings
HTTPEventSource for Server Sent Events icon image
DaGammla
HTTPEventSource for Server Sent Events

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

Supported Engine Version
4.0
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
3 months ago
Git URL
Issue URL

Godot HTTPEventSource for SSE

README ko-fi

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

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
HTTPEventSource for Server Sent Events icon image
DaGammla
HTTPEventSource for Server Sent Events

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

Supported Engine Version
4.0
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
3 months ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers