From acbb817bf5338154b8d13e1656dc17a59c7824bc Mon Sep 17 00:00:00 2001 From: FZambia Date: Fri, 10 May 2024 08:35:28 +0300 Subject: [PATCH] cleanups --- _examples/compression_playground/main.go | 26 ---------------------- _examples/compression_playground/readme.md | 4 ++++ 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/_examples/compression_playground/main.go b/_examples/compression_playground/main.go index 37a9c9a5..3a36ac16 100644 --- a/_examples/compression_playground/main.go +++ b/_examples/compression_playground/main.go @@ -140,13 +140,6 @@ func main() { log.Println(entry.Message, entry.Fields) }, AllowedDeltaTypes: []centrifuge.DeltaType{centrifuge.DeltaTypeFossil}, - //GetChannelLayerOptions: func(channel string) (centrifuge.ChannelMediumOptions, bool) { - // return centrifuge.ChannelMediumOptions{ - // //KeepLatestPublication: true, - // //EnableQueue: true, - // //BroadcastDelay: 500 * time.Millisecond, - // }, true - //}, }) if err != nil { log.Fatal(err) @@ -202,30 +195,11 @@ func main() { useProtobufPayload = true } - //go func() { - // time.Sleep(500 * time.Millisecond) - // client.Disconnect(centrifuge.DisconnectForceReconnect) - //}() - go func() { log.Printf("using protobuf payload: %v", useProtobufPayload) simulateMatch(client.Context(), 0, node, useProtobufPayload) }() - //client.OnCacheEmpty(func(event centrifuge.CacheEmptyEvent) centrifuge.CacheEmptyReply { - // simulateMatch(context.Background(), 0, node) - // //go func() { - // // num := 0 - // // for { - // // - // // num++ - // // time.Sleep(5 * time.Second) - // // } - // //}() - // fmt.Println("simulated") - // return centrifuge.CacheEmptyReply{Populated: true} - //}) - // Set SubscribeHandler to react on every channel subscription attempt // initiated by a client. Here you can theoretically return an error or // disconnect a client from a server if needed. But here we just accept diff --git a/_examples/compression_playground/readme.md b/_examples/compression_playground/readme.md index 180c74e4..373e8d90 100644 --- a/_examples/compression_playground/readme.md +++ b/_examples/compression_playground/readme.md @@ -1,6 +1,10 @@ This is a sample simulation of football match where the entire state is sent into WebSocket connection upon every match event. +The goal is to compare different compression strategies for WebSocket data transfer. Please note, that results +depend a lot on the data you send. You may get absolutely different results for your data. Still we hope this +example gives some insights on how to choose the best compression strategy and what to expect from Centrifuge. + Results with different configurations for total data sent over the interface from server to client, caught with WireShark filter: