Skip to content

Commit

Permalink
[ARV-224] fix: SSE 401 에러 및 컬렉션 에러 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
kwanse committed Feb 17, 2025
1 parent d01cda7 commit ab4864a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.springframework.transaction.event.TransactionPhase;
import org.springframework.transaction.event.TransactionalEventListener;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;

Expand Down Expand Up @@ -78,9 +80,10 @@ public void onMessage(final ConnectedEvent event) {
.orElseThrow(MemberNotFoundException::new);

SortedSet<ChatSummary> chatSummaries = participant.getChatSummaries();
chatSummaries.forEach(summary -> {
Long chatId = summary.getChatId();
List<ChatSummary> summariesCopy = new ArrayList<>(chatSummaries);

summariesCopy.forEach(summary -> {
Long chatId = summary.getChatId();
PreviewMessage previewMessage = findPreviewMessage(
summary.getChatType(),
chatId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.backend.allreva.chatting.notification;

import com.backend.allreva.auth.security.AuthMember;
import com.backend.allreva.common.config.SecurityEndpointPaths;
import com.backend.allreva.member.command.domain.Member;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -31,6 +30,7 @@ public SseEmitter connectNotification(
) {
response.setHeader("Access-Control-Allow-Origin", "https://localhost:3000");
response.setHeader("Access-Control-Allow-Origin", frontProtocol + "://" + frontDomain);
response.setHeader("Access-Control-Allow-Credentials", "true");
return messageSseService.connect(member.getId());
}

Expand Down

0 comments on commit ab4864a

Please sign in to comment.