Skip to content

Commit

Permalink
added http2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirari04 committed Jan 20, 2024
1 parent 0847c9c commit f96aa85
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion inits/Server.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ import (
"net/http"
"os"
"os/signal"
"runtime"
"strings"
"time"

"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"golang.org/x/net/http2"
)

var App *echo.Echo
Expand Down Expand Up @@ -129,7 +131,11 @@ func Server() {
func ServerStart() {
// Start server
go func() {
if err := App.Start(config.ENV.Host); err != nil && err != http.ErrServerClosed {
if err := App.StartH2CServer(config.ENV.Host, &http2.Server{
MaxConcurrentStreams: uint32(runtime.NumGoroutine()),
MaxReadFrameSize: 1048576,
IdleTimeout: 10 * time.Second,
}); err != nil && err != http.ErrServerClosed {
App.Logger.Fatal("shutting down the server")
}
}()
Expand Down

0 comments on commit f96aa85

Please sign in to comment.