Allison Ziegler 6 년 전
부모
커밋
2b5e6f1f2f

+ 1
- 2
src/main/java/com/ziplinegreen/vault/Config/WebSocketConfig.java 파일 보기

@@ -15,13 +15,12 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
15 15
 
16 16
     @Override
17 17
     public void configureMessageBroker(MessageBrokerRegistry config) {
18
-        config.enableSimpleBroker("/topic"); //marks
18
+        config.enableSimpleBroker("/topic");
19 19
         config.setApplicationDestinationPrefixes("/app"); //where the frontend sends things
20 20
     }
21 21
 
22 22
     @Override
23 23
     public void registerStompEndpoints(StompEndpointRegistry registry) {
24
-        //registry.addEndpoint("/posts");
25 24
         registry.addEndpoint("/vault-socket").withSockJS();
26 25
     }
27 26
 }

+ 0
- 1
src/main/java/com/ziplinegreen/vault/Controller/PostController.java 파일 보기

@@ -46,7 +46,6 @@ public class PostController {
46 46
 //    }
47 47
 
48 48
     @MessageMapping("/posts/{userId}")
49
-    //@MessageMapping("/posts")
50 49
     @SendTo("/topic/posts")
51 50
     public Post createPost(@DestinationVariable("userId") Long userId, @RequestBody Post post) {
52 51
     //public Post createPost(@RequestBody Post post) {

+ 0
- 1
src/main/java/com/ziplinegreen/vault/Repository/PostRepository.java 파일 보기

@@ -11,7 +11,6 @@ import org.springframework.stereotype.Repository;
11 11
 
12 12
 @RepositoryRestResource
13 13
 public interface PostRepository extends JpaRepository<Post,Long> {
14
-
15 14
     //@Query("select postcontent,timestamp from Post where user_id = :userId")
16 15
     Iterable<Post> findByUserId(Long userId);
17 16
 }

+ 0
- 6
src/main/resources/static/app.js 파일 보기

@@ -20,7 +20,6 @@ function connect() {
20 20
         console.log('Connected: ' + frame);
21 21
         stompClient.subscribe('/topic/posts', function (greeting) {
22 22
             showGreeting(JSON.parse(greeting.body).message, JSON.parse(greeting.body).userName);
23
-            //showGreeting()
24 23
         });
25 24
     });
26 25
 }
@@ -49,11 +48,6 @@ function user2() {
49 48
     userPostUrl = "/app/posts/2";
50 49
 }
51 50
 
52
-// function sendName() {
53
-//     stompClient.send("/app/posts/1", {}, JSON.stringify({'id': '','message': $("#message").val(),'userId': '1'}));
54
-// }
55
-
56
-
57 51
 
58 52
 function sendName() {
59 53