sockjs-go icon indicating copy to clipboard operation
sockjs-go copied to clipboard

Handler prefix does not allow grouping expressions

Open aronatkins opened this issue 7 years ago • 0 comments

Creating a sockjs handler with a prefix that involves a regular expression group breaks parseSessionID because it uses constant match offsets.

It feels like there are two options:

  1. Trim the prefix-match from the incoming url.Path before attempting the session match.
  2. Take advantage of the named matches (assuming the user-provided prefix does not include the same names).

In my situation, I have two prefix paths that I want to be treated equivalently. Let's call them:

  /foo/bar
  /foo

I am attempting to adjust the client, but that's a little out of my control; I originally tried to work around this situation with:

sockjs.NewHandler(
  "/foo(/bar)?",
  ...
)

aronatkins avatar Oct 19 '16 13:10 aronatkins