numo-labs / aws-lambda-helper

:lollipop: Collection of helper methods for lambda
GNU General Public License v3.0
22 stars 2 forks source link

Web socket server post request body #40

Open nikhilaravi opened 8 years ago

nikhilaravi commented 8 years ago

The json object sent to the server should have the shape:

{
  "id": // socket connection id
  "searchId": // search bucket id
  "items": // array of packages/tiles
}
nelsonic commented 8 years ago

@nikhilaravi just to confirm, the searchId is a unique id for each search that gets performed by the client so that the UI knows which result it needs to be displaying, right? ❓

nelsonic commented 8 years ago

@nikhilaravi quick question: are you storing the searchId somewhere on the client? I ask because if we store it in localStorage it will prevent the user from having multiple tabs open with different searches...

nikhilaravi commented 8 years ago

@nelsonic yes i'm saving it in the redux store. I expect the searchId to be returned from the graphql mutation which starts the search.

nelsonic commented 8 years ago

@nikhilaravi do you know if the searchId is currently being passed through by search-request-handler thru SNS to the providers?

nikhilaravi commented 8 years ago

@nelsonic it looks like it is sent in the SNS message by the search request handler. https://github.com/numo-labs/lambda-search-request-handler/blob/master/lib/formatter.js#L18-L21

nelsonic commented 8 years ago

That looks like its sending everything in the event and id but what is id ...? is that the searchId or the bucketId ...? Because I'm expecting that to be the bucketId ... see: https://github.com/numo-labs/lambda-ne-classic-package-provider/blob/master/index.js#L19 where I'm using the event.Records[0].Sns.Message.id as the bucketId ...

nikhilaravi commented 8 years ago

@nelsonic ah I am actually referring to the bucketId when I'm talking about the searchId..!

I thought even if we get rid of the idea of search buckets in dynamoDB we can still use the same id as a reference to that particular search.