https://pine32.be - © pine32.be 2024
Welcome! - 58 total posts. [RSS]
A funny little cycle. [LATEST]


Search 58 posts with 29 unique tags


#1708895446


[ music | scene ]

I know what you want

Cover Art

To many music posts but nobody can stop me.

#1708464707


[ music | MF_DOOM | hiphop ]

Fire beat

Cover Art

#1707727407


[ golang | webdev ]

SSE are cool.

This an example using the Echo framework in Golang. It sets up the connection, consumes a channel and sends that data to the user. It also exits the loop if the connection is broken, this is communicated via the request context.

func BuildingSSE(c echo.Context) error {
	c.Response().Header().Set(echo.HeaderCacheControl, "no-cache")
	c.Response().Header().Set(echo.HeaderConnection, "keep-alive")
	c.Response().Header().Set(echo.HeaderContentType, "text/event-stream")

	queue := queue.GetBuildQueue()

	ctx := c.Request().Context()
	for {
		select {
		case result := <-queue.BuildLogsChannel:
			fmt.Fprint(c.Response(), buildSSE("message", result))
			c.Response().Flush()
		case <-ctx.Done():
			return nil
		}
	}
}

func buildSSE(event, context string) string {
	var result string
	if len(event) != 0 {
		result = result + "event: " + event + "\n"
	}
	if len(context) != 0 {
		result = result + "data: " + context + "\n"
	}
	result = result + "\n"
	return result
}

#1707727213


[ music | core ]

The beauty of my heart is not contagious!?
うつらない の わ こころ の うつくしさ

Cover Art

#1707657516


[ music | core | drums ]

It’s a funny little cycle

YouTube Thumbnail

Cover Art

#1707591969


[ music | dubstep ]

Throwback

Cover Art

Cover Art

#1707084791


[ mb_dev | music ]

Custom embeds :D

With this feature done, mb is now ready for its first deployment.

Players never doubt

YouTube Thumbnail

Cover Art

#1707084494


[ music | MF_DOOM | hiphop ]

Vik Vaughn is a loser

Let me watch…

Cover Art