https://github.com/lpil/node-socket-client
https://github.com/lpil/node-socket-client
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lpil/node-socket-client
- Owner: lpil
- Created: 2024-07-15T22:19:48.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-22T11:29:07.000Z (4 months ago)
- Last Synced: 2026-01-23T02:27:46.811Z (4 months ago)
- Language: Gleam
- Size: 8.79 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# node_socket_client
Bindings to Node's TCP socket client.
[](https://hex.pm/packages/node_socket_client)
[](https://hexdocs.pm/node_socket_client/)
```sh
gleam add node_socket_client@1
```
```gleam
import node_socket_client.{DataEvent, CloseEvent, ErrorEvent} as socket
pub fn main() {
socket.connect("localhost", 3000, 0, fn(count, _socket, event) {
case event {
DataEvent(data) -> io.println("Got data: " <> data)
ErrorEvent(error) -> io.println("Got error: " <> error)
CloseEvent(had_error: True) -> io.println("Closed with error")
CloseEvent(had_error: False) -> io.println("Closed")
_other_event -> Nil
}
count + 1
})
}
```
Further documentation can be found at .