# 11월 1일 금뇨일

웹소켓 Vue 연결

```bash
methods: {
    async fetchPreviousMessages() {
      try {
        const response = await fetch(`/api/chat/history/`);  // API 접근을 위한 URL을 사용
        if (response.ok) {
          const data = await response.json();
          this.message = data.map(msg => ({
            user: msg.user,
            message: msg.content  // Django에서 반환된 데이터와 일치하도록 설정
          }));
        } else {
          console.error("Failed to load previous messages. Status:", response.status, response.statusText);
        }
      } catch (error) {
        console.error("Error fetching previous messages:", error);
      }
    },
```

* WebSocket 연결 종료: CloseEvent {isTrusted: true, wasClean: false, code: 1011, reason: '', type: 'close', …} isTrusted  
    채팅사이트에서 채팅은 안쳐지고 1011서버 오류가 뜸
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1730457324988/f767055b-652c-4a97-87d9-e36b6463d4b2.png align="center")

해결 방법:DB 모델 수정 및 오타 개선 존이 있었다 requierment가 문제였다
