[Solved] Create a generic channel


What I was trying to accomplish will be possible in Go v1.18, as commented by @torek in my question.

For now, what I ended doing was this:

handler := &ws.SessionHandler{
    Subscribers:      make(map[chan json.RawMessage]bool),
}

I stopped relying on a go struct and communicated json.RawMessage in my channels. It’s not totally clean because I need to marshal/unmarshal my message to give the proper treatment, but its “generic” and I could accomplish what I was trying to do.

0

solved Create a generic channel