
Product
Introducing Module Reachability: Focus on the Vulnerabilities That Matter
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
@winglibs/websockets
Advanced tools
This library enables you to create WebSockets using Wing.
WebSockets offer a persistent, bidirectional communication channel between a client and a server, facilitating real-time, low-latency communication.
By incorporating WebSockets through the Wing library, developers can enhance the interactivity and responsiveness of their applications, delivering a more engaging user experience. Whether you're building a real-time chat application or a collaborative tool, understanding and implementing WebSockets with Wing can significantly elevate your web development projects.
npm i @winglibs/websockets
The example above shows us how we can broadcast a message to any connection assigned to the WebSocket.
bring cloud;
bring ex;
bring websockets;
let tb = new ex.DynamodbTable(
name: "WebSocketTable",
hashKey: "connectionId",
attributeDefinitions: {
"connectionId": "S",
},
);
let wb = new websockets.WebSocket(name: "MyWebSocket") as "my-websocket";
wb.onConnect(inflight(id: str): void => {
tb.putItem({
item: {
"connectionId": id
}
});
});
wb.onDisconnect(inflight(id: str): void => {
tb.deleteItem({
key: {
"connectionId": id
}
});
});
wb.onMessage(inflight (id: str, body: str): void => {
let connections = tb.scan();
for item in connections.items {
wb.sendMessage(str.fromJson(item["connectionId"]), body);
}
});
sim
When executing in the Wing Simulator, the WebSocket uses the ws
library.
tf-aws
When running on AWS, the WebSocket utilizes the WebSocket API of API Gateway.
awscdk
When running on AWS, the WebSocket utilizes the WebSocket API of API Gateway.
To compile to awscdk
, we need to import the @winglang/platform-awscdk
.
This library is licensed under the MIT License.
FAQs
WebSocket library for Wing
We found that @winglibs/websockets demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Module Reachability filters out unreachable CVEs so you can focus on vulnerabilities that actually matter to your application.
Company News
Socket is bringing best-in-class reachability analysis into the platform — cutting false positives, accelerating triage, and cementing our place as the leader in software supply chain security.
Product
Socket is introducing a new way to organize repositories and apply repository-specific security policies.