612
questions
0
votes
1
answer
52
views
Gorilla Websocket WriteMessage leading Out of memory on using WriteBufferPool
I've upgraded to websocket with following upgrader
var upgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferPool: &writeBufferPool,
EnableCompression: false,
}
var ...
1
vote
1
answer
31
views
Golang: gorilla - how to handle requests to endpoint defined with url parameter when the parameter is empty
I have this endpoint definition:
router.NotFoundHandler = http.HandlerFunc(handlerNotFound)
router.HandleFunc("/customer/{id}", handlerCustUpd).Methods(http.MethodPut)
When called URL https:...
1
vote
0
answers
22
views
subrouting with mux leads to 404
i am trying to create subroutes for my app with gorilla mux
this is my router package:
type IRouter interface {
Get(uri string, f func(w http.ResponseWriter, r *http.Request))
Post(uri string, ...
1
vote
1
answer
32
views
Managing Gorilla WebSocket Connections in a Real-Time Application
I'm currently working on a real-time application that utilizes Gorilla WebSocket in conjunction with Next.js. One of the challenges I'm facing is that when a user refreshes the page, a new WebSocket ...
1
vote
1
answer
47
views
Why can't I chain a `Use()` with `HandleFunc()` while setting up middleware in Gorilla/mux?
I am trying to add a simple user ID validation middleware to a route like so:
api package contains:
func RegisterUserRoutes(router *mux.Router) {
router.HandleFunc("/{id}/follower/{...
2
votes
1
answer
137
views
Authorization Error in API Gateway endpoints using lambda with Chalice code
Here is the scenario:
I had a Chalice app with two endpoints /getStream and /deleteStream.
I migrated them to Nextjs functions eliminating the need for a Chalice app.
So, I deleted the API Gateway ...
1
vote
1
answer
60
views
404 Not Working With React App on Golang Server [duplicate]
My Redirection works perfectly when running reactjs app in development environment (npm run dev), proper redirect to home. But when i serving same app on golang, after npm run build, redirection doesn'...
2
votes
0
answers
154
views
Unable to retrieve session value in Go Gin
Problem: The session data set during login is not persisting across subsequent requests.
Expected output: The session data set during login should be stored and is accessible persist requests.
func (...
0
votes
0
answers
280
views
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at.... CORS preflight response did not succeed
So, I'm creating a reactjs page where I want to consume a Golang Gorilla Mux api. But whenever I call the api this way:
fetch('http://localhost:8080/commands/', {
method: 'POST',
...
1
vote
2
answers
96
views
CORS Error: It does not have HTTP ok status. GoLang Mux API
I'm trying to make http requests via Angular 17 App. And everytime the browser responds:
Access to XMLHttpRequest at 'http://localhost:8082/login' from origin
'http://localhost:4200' has been blocked ...
1
vote
1
answer
134
views
grpc-gateway: Context being passed to http handler losing values set on context
I'm at a loss with what is going on with my context between my GRPC handler and it calling gwmux.ServeHTTP(w, r.WithContext(ctx)
I've stripped out a lot of the code to try and only include the bare ...
0
votes
0
answers
62
views
Websocket write doesn't fail even if the network connection is broken [duplicate]
I have a websocket connection to another server in a different network and I keep sending data to it using the gorilla websocket lib's WriteMessage method.
https://github.com/gorilla/websocket/blob/...
1
vote
1
answer
72
views
Prepoluting index page before mux Handle call
I recently built a small blog website for testing purposes and I'm a little stuck with this problem while writing the server in Go. I have all the files of the website inside the static folder, which ...
1
vote
0
answers
76
views
Incorrect message sending to Centrifuge
Please help me solve the error. I have a Docker container with Centrifuge. I need to send messages to the 'user' channel. Everything should happen on the backend side - without involving the browser.
...
2
votes
2
answers
530
views
Gorilla session package error : "securecookie: hash key is not set"
I created an HTTP API to register with the GIN HTTP package and Gorilla Sessions. But I get an error message like the following:
"error": "securecookie: hash key is not set"
here ...
-1
votes
1
answer
353
views
TypeScript Error: "Expected 0-1 arguments, but got 2" when initializing Mux object
I'm using TypeScript with the Mux library for video handling in my application. As per the documentation, I'm attempting to initialize a Mux object with the required token ID and token secret obtained ...
1
vote
1
answer
55
views
Handling the upgrade of a request client-side
I'm probably being stupid here, but I am upgrading a HTML Request to a WS, with Gorilla Mux, and can't seem to figure out how to access the WebSocket on the Webpage after upgrade,
func loadSecureThing(...
1
vote
0
answers
151
views
Error fetching data: SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>)
im having problems with gorilla sessions mainly, but with nextjs and frontend too, i can fetch all my data with no problem, but when i try to send the user to the front end from the gorilla session ...
0
votes
0
answers
282
views
Golang gorilla websocket server refusing further connections after accepting approximately 16,300 concurrent connections
I am running Ubuntu Server 22.04 on a virtual machine with a configuration of 16 CPUs and 32GB of RAM. On this virtual machine, I have deployed a Golang server using Gorilla WebSocket with the goal of ...
0
votes
1
answer
38
views
Manually deleting val from context map using Gorilla middleware
Do I need to do this:
r.Use(func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
muxctx.Set(r, "req-res-ctx", &mw.Ctx{...
1
vote
1
answer
364
views
How to implement http.Hijacker using Gorilla Websockets & alexedwards/scs/v2
Recently upgraded the excellent alexedwards/scs/v2 within a Go webapp from 2.5.0 to 2.7.0 to allow for Go 1.20+ support for http.NewResponseController(). Subsequently to allow for extending handler ...
1
vote
1
answer
71
views
Trouble serving JavaScript and asset files with Gorilla Mux in Golang
I have file system like this:
-- api
-> api.go
-- styles
-> style1.css
-> style2.css
-> ...
-- scripts
-> script1.js
-> script2.js
-> ...
-- ...
-3
votes
2
answers
661
views
How to get value of url inside a function in golang [closed]
I have this router function with mux:
func InitRouter() {
r := http.NewServeMux()
r.HandleFunc("/{id}", getWords)
log.Fatal(http.ListenAndServe(":8000", r))
}
I want ...
0
votes
1
answer
106
views
How to read only the first X bytes of a message using Golang
Say I have some WS code like so:
var upgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
}
func handleConnections(w http.ResponseWriter, r *http.Request) {
ws, ...
1
vote
2
answers
303
views
Error getting the body with middleware in Golang
I am creating an endpoint and I am using the JSONContentExtractor middleware to obtain the context, but if I use it I cannot obtain the Body in the handler.
package main
import (
"encoding/json&...
3
votes
1
answer
1k
views
Get trace_id from OTEL trace instrumented with golang otelmux
In my golang application, I've instrumented OTEL tracing middleware with otelmux middleware and ddotel tracer provider:
package tracing
import (
"github.com/gorilla/mux"
"go....
0
votes
0
answers
169
views
Golang Websocket Interact: error: Invalid WebSocket frame: RSV2 and RSV3 must be clear
When i am trying to connect through websocket, i am getting this error - Invalid WebSocket frame: RSV2 and RSV3 must be clear using wscat. When i used HTML which is provided bellow, it give error in ...
0
votes
1
answer
143
views
C++ LibAV muxing raw H264 into MP4 container and keeping on the buffer
I have an array of raw H264 AVPackets which get from IP Camera's RTSP.
so I'm going to put them into MP4 container (not to the file into the buffer) then stream the buffer on the network.
I read ...
1
vote
0
answers
210
views
Setting cookies client side in Golang
Good morning everyone,
I'm trying to build a test web-app with Go, but I can't seem to find a way to properly set the cookies. I'm using the securecookie function from gorilla package, and it works ...
0
votes
0
answers
2k
views
How to solve write: broken pipe on websocket?
I'm making a progress bar for my program, and send it to client. The IPC I used is websocket. But I'm facing write: broken pipe when updating progress bar to the client. This error occurs after the ...
2
votes
1
answer
572
views
Golang Mux Router CORS Error when Adding Credentials to Request
I simply need to allow for credentials in my Go Mux router. It seems like it should be pretty straight forward. As soon as I set withCredentials to true in my axios interceptor, I only get CORS errors....
0
votes
0
answers
785
views
How to play an IPTV live stream without an extension using Next.js?
I'm currently working on a Next.js project where I'm trying to create a video player to stream live IPTV feeds. The URLs of the streams I'm working with don't have an extension and don't use a ...
1
vote
1
answer
133
views
Why does mux.Vars() returns empty map[]
I get an empty map[] from mux.Vars[].
After tracing the problem, it seems to be an empty map[] passed through my multiple files.
While in the same file: I have imported the other file as a module(I ...
1
vote
0
answers
70
views
Logout Only Works After Go Restart
Problem Details and Results
I really really do not understand what is wrong here and how to fix it. So, my goals are:
All projects are showing when there are no user logged in, BUT, the edit and ...
2
votes
0
answers
34
views
MongoDB connection getting terminated for a Post function
I have written a backend in Go for basic CRUD application. While working with Post function which can store images and other information in my DB the connection is getting terminated. This is what ...
2
votes
1
answer
894
views
WebSocket returning 403 every time
I'm not sure why this error keeps occurring but when I try connecting in my web browser it fails and returns 403, but it doesn't make sense since no where in my code I specifically told it to return ...
2
votes
0
answers
276
views
Redis is not showing as a dependency in Elastic apm
I am using Elastic apm to monitor my go application.I use gorilla mux framework and redis db.I have integrated elastic apm with my code but I am not sure how to add redis as a dependency in elastic ...
1
vote
0
answers
201
views
React Native Video using Mux
Currently I am using the Mux enter link description here
for video playing inside the flatlist.
Also I had pass the required props for optimizing the flatlist.
But in some device video is loading and ...
3
votes
1
answer
101
views
golang: github/gorilla/mux supports regression url path
When I want url path works well, with tail "/", and without tail "/"
mux1 *mux.Router
mux1.Handle("/example/", ...).Methods("GET")
I want these 2 urls ...
1
vote
1
answer
161
views
How do I print the url path without parameters?
I have a RESTful API using Gorilla/mux. It is parameterized in the path. I am creating it as such:
r := mux.NewRouter()
subr := r.PathPrefix("/v1").Subrouter()
subr.Handle("/...
2
votes
1
answer
159
views
How to get response only for a specific path/endpoint?
router.HandleFunc("/v1/m/mailboxes", s.handleGetAllMailboxes()).Methods(http.MethodGet)
func (s *Server) handleGetAllMailboxes() http.HandlerFunc {
return func(w http.ResponseWriter, r *...
2
votes
0
answers
255
views
How do i pass multiple params to the gorilla mux router endponit?
I am getting error like " cannot refer to unexported name controllers.GetProducts" when passing more than one param in the below routing endpoint. Am i doing anything wrong below?
func main()...
2
votes
1
answer
859
views
Use MUX Player (Video) in Angular 14/15
Mux is a video API service that has its own player: MUX Player
I am wanting to use this npm package in Angular 14/15 by importing it into a specific component only. The js should only be loaded when ...
1
vote
0
answers
30
views
How to access another user's session in Gorilla Session store?
I'd like to let moderators to remove a banned user's session, so that he can not post anymore. But what I see in the gorilla/sessions documentation is the scenario where you can get session from ...
1
vote
2
answers
258
views
Adding query parameters when using Gorilla mux
I'm learning REST API development with go and cant figure out how to go about getting user specific documents.
My use case is a typical get request that can fetch all the documents in a slice. However ...
0
votes
0
answers
43
views
Websockets and management of different unrelated data
I am looking for a bit of guidance here, as after spending lots of time browsing various tutorials and SO answers, I have failed to find something that would help me move forward, although what I want ...
2
votes
1
answer
560
views
How to combine mux (gorilla) in Go?
I have the following code in which I have two mux, one for unauthenticated routes (r) and another for authenticated routes (chain). I want to combine these two and serve.
package main
import (
&...
3
votes
0
answers
645
views
Created an API but getting 511 network authentication error at client end
I am trying to create a simple web app, where I am using Go to create the backend and svelte to create the frontend. Backend is hosted on port 8080 and frontend on 5173. I used a node package '...
2
votes
0
answers
373
views
Why i can't connect to gorilla websocket server from front page?
backend code:
func WsHandler(c *gin.Context) {
upgrader.CheckOrigin = func(r *http.Request) bool {
return true
}
conn, err := upgrader.Upgrade(c.Writer, c.Request, nil)
if err !...
1
vote
1
answer
713
views
Adding to GET the same endpoint with POST and different Queries ends up with inconsistent error messages
When adding the same routes with different methods, and per method queries the response of a get call is different, however since the other method is POST it should be unaffected.
With POST:
...