question

mendozamt avatar image
mendozamt asked David Marginian Deactivated answered

Remote-pay-cloud upgrade to 4.1.2 getting error when providing auth token

I've upgraded the remote-pay-cloud SDK to 4.1.2 and updated the webSocketFactoryFunction, initially I can pair with the Clover Mini, process charges, refunds and voids successfully.

When I want to pair again though and I provide the authentication token from the first pairing I'm getting errors and cannot connect. Error:

error A websocket connection error has occurred. Details: unexpected server response (404)

I've checked and the correct token is received in the protocols parameter of websocket.js.

We are using connectorType of network, NOT cloud.

We are working on the changes requested in you e-mail of Nov 03 2021, so that URL query parameters for authentication are no longer used. With these changes, will it still be possible to avoid pairing a second time?

Remote Pay Cloud
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image David Marginian ♦♦ commented ·
I will check, but if you are using SNPD and network connection you shouldn't need to change anything. Have you tried reverting your changes?
0 Likes 0 ·
David Marginian avatar image
David Marginian Deactivated answered

I just confirmed that you do not need to make the changes if you are using the network protocol.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mendozamt avatar image
mendozamt answered David Marginian Deactivated converted comment to answer

Hi David,

Yes, we are using SNPD and network connection. So I made the changes posted on the Node.js Usage section of the release (https://github.com/clover/remote-pay-cloud/releases):

If you are using node.js and are providing a webSocketFactoryFunction in your device connection configuration you will need to update your function to create a websocket that passes the access token in the Sec-WebSocket-Protocol header. An example can be found here and here.
If you want to use the https://www.npmjs.com/package/ws implementation, you can create a global variable in your code like global.WebSocket = require('ws') and then you are not required to use the webSocketFactoryFunction parameter.

Once I reverted the changes to the webSocketFactoryFunction, I can use the previously issued authentication token, and process transactions without issues. So just want to confirm that we don't need the changes described on the Node.js Usage section.

Thank you,

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mendozamt avatar image
mendozamt answered

Awesome, thank you David for resolving this issue so quickly for us.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community