title: Can you send a message to a websocket client from a non-websocket lambda?
body: <p>I have a nodejs websocket AWS lambda endpoint (Api Gateway) set up and it connects and can echo messages back. During initial connection, I save the endpoint and connection_id to a database. That gets saved just fine. If I open a browser client, and connect to the websocket endpoint, I can connect successfully, and send a message from the browser successfully - I have code to echo the message back, and it works.</p>
  
  <p>Now, in another nodejs lambda, one that provides a REST endpoint, I have code that loads the connection_id from the database and does this:</p>
  
  <pre><code>// 'connection' is loaded successfully from DB (I log it and see the right values)
  let api = new AWSSDK.ApiGatewayManagementApi({apiVersion: '2018-11-29', endpoint: connection.endpoint});
  
  await api.postToConnection({
                  ConnectionId: connection.connection_id,
                  Data: JSON.stringify({ message: 'Hello World' })
              }).promise();
  </code></pre>
  
  <p>However, the code in the REST endpoint (code above) always gets a 410 error in the postToConnection. I know the connection is still active, since I can connect to it and ping it in a browser client just prior to testing the REST API above. </p>
  
  <p>Is it not possible to post to a websocket connection from a non-websocket lambda?</p>