Question: I have:

```
Row 114005: Requester Name: "RETAIL\S2343W01$" Issued Common Name: "S2343W01.retail.fakename.com" User Principal Name: "S2343W01.retail.fakename.com" Serial Number: "4c22be0100010002d317" Certificate Template: Client Authentication - Retail Desktops Certificate Effective Date: 12/1/2011 10:38 AM Certificate Expiration Date: 11/30/2012 10:38 AMMaximum Row Index: 114005

```

And I have regex:

```
(?i)Serial Number: “(?P<cert_SN>.+?\n)

```

Result is like:

```
cert_SN = 4c22be0100010002d317"

```

How can I eliminate the final quote?

Answer: 
The way sockets work in node.js is quite a bit different from the way normal requests work. There is no routing, so rather than listening to a url, you have to listen to all sockets. The default behavior of `socket.io` is to close any socket connections that it doesn't recognize. To fix this, you'll need to add the flag `'destroy upgrade': false` to the options (`server` is an express server):

```
require('socket.io').listen(server, {'destroy upgrade': false, ...})

```

You'll also need to check the url when a client connects (in the code handling `/websocket`) and ignore it if it looks like it belongs to `socket.io`. You can find the url from the client object (passed in to the on `connection` handler) as `client.upgradeReq.url`.
Update for 2016:

```
io.disable('destroy upgrade');

```

seems not to be available anymore.
But I succeeded by assigning the websocket module ws a path (using Express):

```
 var wss = new WebSocketServer({ server: server, path: '/ws' }); //do not interfere with socket.io

```

Of course the client has the same path ws://theserver.com/ws

I did not have to alter the socket.io side at all.