Closed thekid closed 1 year ago
Example:
use com\amazon\aws\{Credentials, ServiceEndpoint}; $credentials= ...; return function($event, $context) use($credentials) { // Send message to WebSocket connection (new ServiceEndpoint('execute-api', $credentials)) ->in($context->region) ->using($event['requestContext']['domainName']) // or: ->using($event['requestContext']['apiId']) ->resource('/{stage}/@connections/{connectionId}', $event['requestContext']) ->transmit(['message' => 'Reply']) ; return ['statusCode' => 200]; };
Verified this works in a production setup.
Released in https://github.com/xp-forge/aws/releases/tag/v1.0.0
Example: