mirror repo of https://github.com/littlequartz/clink. a socket programming assignment for Sistem Terdistribusi
Go to file
Syahdan 676b45cd23 refactor(net): modelled connection lifecycle with typed msgs; switch to line-by-line reader
- Introduce typed msgs: connectedMsg, disconnectedMsg, errorMsg, and netMsg
- connectCmd now returns connectedMsg on success instead of “[connected]”
- Add readLineCmd to read a single line via bufio.Reader and emit netMsg
  - Handles io.EOF as disconnectedMsg; reports other errors as “[error] read: …”
- Update loop:
  - On connectedMsg: store conn, append “[connected]”, schedule first readLineCmd
  - On netMsg: append message, schedule next readLineCmd unless it’s a read error
  - On disconnectedMsg: append “[disconnected]”, close and clear conn
- UI tweaks: textarea placeholder uses "..." and height reduced from 3 to 2
- Window sizing: set viewport width; removed old netMsg branch now superseded by typed msgs

This removes the scanner goroutine pattern in favor of Cmd-driven incremental reads.
2025-10-15 11:23:47 +07:00
go.mod initial commit 2025-10-15 00:19:34 +07:00
go.sum initial commit 2025-10-15 00:19:34 +07:00
main.go refactor(net): modelled connection lifecycle with typed msgs; switch to line-by-line reader 2025-10-15 11:23:47 +07:00
server.go initial commit 2025-10-15 00:19:34 +07:00