Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…king-system-server into PBS-64-Manage-User-Api
  • Loading branch information
Hoang-Nguyen-Huy committed Oct 11, 2024
2 parents d1ce73d + f9c0e0c commit 37cfdd1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.swp.PodBookingSystem.controller;

import com.swp.PodBookingSystem.dto.request.ChatMessage;
import com.swp.PodBookingSystem.dto.socketPayload.UpdateOrder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.Payload;
Expand All @@ -12,11 +13,11 @@
@Slf4j
@RestController
public class SocketController {
@MessageMapping("/chat")
@SendTo("/topic/messages")
public ChatMessage sendMessage(@Payload ChatMessage chatMessage) {
log.info("Received message: {}", chatMessage.getContent());
chatMessage.setTimestamp(new Date());
return chatMessage;

@MessageMapping("/payments")
@SendTo("/topic/payments")
public UpdateOrder updateOrder(@Payload UpdateOrder updateOrder) {
log.info("Received message: {}", updateOrder.getId());
return updateOrder;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.swp.PodBookingSystem.dto.socketPayload;

import lombok.*;
import lombok.experimental.FieldDefaults;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@FieldDefaults(level = AccessLevel.PRIVATE)
public class UpdateOrder {
int id;
}

0 comments on commit 37cfdd1

Please sign in to comment.