Last active
March 26, 2021 03:45
-
-
Save shaykav/37599443c88dfdbb53ee3041b8bf0f0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const handler: Handler<APIGatewayEvent> = async (event, context, callback) => { | |
if (!event.requestContext) { | |
return { | |
statusCode: 500, | |
body: '' | |
}; | |
} | |
const { eventType, connectionId } = event.requestContext; | |
if (eventType === 'CONNECT') { | |
// handle connect | |
return { | |
statusCode: 200, | |
body: '' | |
}; | |
} | |
if (eventType === 'DISCONNECT') { | |
// handle disconnect | |
return { | |
statusCode: 200, | |
body: '' | |
}; | |
} | |
if (eventType === 'MESSAGE') { | |
// handle message | |
return { | |
statusCode: 200, | |
body: '' | |
}; | |
} | |
return { | |
statusCode: 500, | |
body: '' | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment