tangled
alpha
login
or
join now
atscan.net
/
plcbundle
A Transparent and Verifiable Way to Sync the AT Protocol's PLC Directory
14
fork
atom
overview
issues
2
pulls
pipelines
ws fix
tree.fail
3 months ago
fcd7fcff
a99be5a3
+12
-1
1 changed file
expand all
collapse all
unified
split
cmd
plcbundle
main.go
+12
-1
cmd/plcbundle/main.go
···
1000
1000
sync := fs.Bool("sync", false, "enable sync mode (auto-sync from PLC)")
1001
1001
plcURL := fs.String("plc", "https://plc.directory", "PLC directory URL (for sync mode)")
1002
1002
syncInterval := fs.Duration("sync-interval", 5*time.Minute, "sync interval for sync mode")
1003
1003
+
enableWebSocket := fs.Bool("websocket", false, "enable WebSocket endpoint for streaming records") // RE-ADDED
1003
1004
workers := fs.Int("workers", 4, "number of workers for auto-rebuild (0 = CPU count)")
1004
1005
fs.Parse(os.Args[2:])
1005
1006
···
1094
1095
fmt.Printf(" Sync mode: disabled\n")
1095
1096
}
1096
1097
1098
1098
+
if *enableWebSocket {
1099
1099
+
wsScheme := "ws"
1100
1100
+
if strings.Contains(addr, "0.0.0.0") || strings.Contains(addr, "127.0.0.1") {
1101
1101
+
wsScheme = "ws"
1102
1102
+
}
1103
1103
+
fmt.Printf(" WebSocket: ENABLED (%s://%s/ws)\n", wsScheme, addr)
1104
1104
+
} else {
1105
1105
+
fmt.Printf(" WebSocket: disabled (use --websocket to enable)\n")
1106
1106
+
}
1107
1107
+
1097
1108
// Show current status
1098
1109
index := mgr.GetIndex()
1099
1110
bundleCount := index.Count()
···
1117
1128
1118
1129
server := &http.Server{
1119
1130
Addr: addr,
1120
1120
-
Handler: newServerHandler(mgr, *sync, false), // WebSocket disabled for now
1131
1131
+
Handler: newServerHandler(mgr, *sync, *enableWebSocket), // FIXED - pass the flag
1121
1132
ReadTimeout: 30 * time.Second,
1122
1133
WriteTimeout: 30 * time.Second,
1123
1134
}