Skip to content

Commit 20b6ce0

Browse files
committed
Fix merge conflicts from branch: n1-comms
1 parent 9cb7ff4 commit 20b6ce0

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

collab/main.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"log"
88
"net/http"
99
"os"
10-
"sync"
1110
"strconv"
11+
"sync"
1212

1313
"github.com/gin-gonic/gin"
1414
"github.com/gorilla/websocket"
@@ -144,9 +144,9 @@ func (h *Hub) Run() {
144144

145145
// ServeWs handles WebSocket requests
146146
func serveWs(
147-
hub *Hub, c *gin.Context,
148-
roomMappings *verify.RoomMappings,
149-
persistMappings *verify.PersistMappings,
147+
hub *Hub, c *gin.Context,
148+
roomMappings *verify.RoomMappings,
149+
persistMappings *verify.PersistMappings,
150150
) {
151151
log.Println("handler called!")
152152
roomID := c.Query("roomID")
@@ -168,9 +168,9 @@ func serveWs(
168168
}
169169

170170
func authenticateClient(
171-
token string, match string, client *Client,
172-
roomMappings *verify.RoomMappings,
173-
persistMappings *verify.PersistMappings,
171+
token string, match string, client *Client,
172+
roomMappings *verify.RoomMappings,
173+
persistMappings *verify.PersistMappings,
174174
) bool {
175175
ok, userID := verifyToken(token)
176176
if !ok {
@@ -197,7 +197,8 @@ func handleMessages(
197197
client *Client, hub *Hub,
198198
roomMappings *verify.RoomMappings,
199199
persistMappings *verify.PersistMappings,
200-
) { defer func() {
200+
) {
201+
defer func() {
201202
hub.unregister <- client
202203
}()
203204

@@ -274,11 +275,11 @@ func statusHandler(hub *Hub) gin.HandlerFunc {
274275
for client := range hub.clients {
275276
roomID := client.roomID
276277
currentStatus, ok := status[roomID]
277-
if (!ok) {
278+
if !ok {
278279
// Initialize status for a new roomID
279280
status[roomID] = map[string]interface{}{
280-
"clients": 1,
281-
"workspace": hub.workspaces[roomID],
281+
"clients": 1,
282+
"workspace": hub.workspaces[roomID],
282283
}
283284
} else {
284285
// Update the client count for an existing roomID
@@ -324,8 +325,8 @@ func main() {
324325
}
325326
}
326327

327-
roomMappings := verify.InitialiseRoomMappings(REDIS_URI, REDIS_ROOM_MAPPING)
328-
persistMappings := verify.InitialisePersistMappings(REDIS_URI, REDIS_ROOM_PERSIST);
328+
roomMappings := verify.InitialiseRoomMappings(REDIS_URI, REDIS_ROOM_MAPPING)
329+
persistMappings := verify.InitialisePersistMappings(REDIS_URI, REDIS_ROOM_PERSIST)
329330

330331
// WebSocket connection endpoint
331332
r.GET("/ws", func(c *gin.Context) {

peerprep/components/questionpage/CollabEditor.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ interface Message {
5454
data?: string;
5555
userId?: string | undefined;
5656
token?: string;
57+
matchHash?: string;
5758
}
5859

5960
const dmp = new diff_match_patch();

0 commit comments

Comments
 (0)