sockjs

Websocket creation using sockjs-client/sockjs in angular2 webapp project

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using Angular2 webapp project for FRONT-END and Vertex3 for BACK-END. Using Sockjs-client i'm creating websocket (at client side) to create a communication channel between Frontend and Backend. I have installed sockjs-client using npm : npm install sockjs-client When I import sockjs-client in LoginService.ts file : import * as SockJS from 'sockjs-client'; export class LoginService { URL: string = 'http://localhost:8082/eventbus'; sock: SockJS; handlers = {}; private _opened: boolean = false; public open(): void { if (!this._opened) {

Sending message to client periodically via Spring Web-Socket

孤街醉人 提交于 2019-12-02 23:01:35
I'm trying to make a connection between client and server via Spring webSocket and I'm doing this by the help of this link . I want Controller to send a "hello" to client every 5 seconds and client append it to the greeting box every time. This is the controller class: @EnableScheduling @Controller public class GreetingController { @Scheduled(fixedRate = 5000) @MessageMapping("/hello") @SendTo("/topic/greetings") public Greeting greeting() throws Exception { Thread.sleep(1000); // simulated delay System.out.println("scheduled"); return new Greeting("Hello"); } } and This is Connect() function

Websocket in Spring Boot app - Getting 403 Forbidden

依然范特西╮ 提交于 2019-12-02 20:33:18
Websocket in Spring Boot app - Getting 403 Forbidden I can connect to the websocket from client using sockjs/stompjs when I run this in eclipse (no spring boot). But when I create a Spring boot jar(gradlew build) for the websocket code and run the java -jar websocket-code.jar I get a 403 error connecting to the websocket. I have no authentication for the websockets. I have a CORS filters and think have all headers right in request/response. Below is my build.gradle apply plugin: 'java' apply plugin: 'spring-boot' apply plugin: 'war' sourceCompatibility = 1.7 version = '1.0' repositories {

How to properly configure Stomp and SockJS endpoint in Spring MVC?

筅森魡賤 提交于 2019-12-02 07:04:43
问题 This is/may be duplicate of: Websocket - InvalidStateError: The connection has not been established yet. I am implementing Notification System. And want to initialize Socket connection when user Logged In, and show him his notifications, and also if some event happens. My Code snippet as follows. websocket.js : var stompClient = null; function connect( temp ) { alert(temp); //var socket = new SockJS("/websock"); //var socket = new SockJS("/websock"+temp); var socket = new SockJS(context_path+

How to properly configure Stomp and SockJS endpoint in Spring MVC?

风流意气都作罢 提交于 2019-12-02 03:56:16
This is/may be duplicate of: Websocket - InvalidStateError: The connection has not been established yet . I am implementing Notification System. And want to initialize Socket connection when user Logged In, and show him his notifications, and also if some event happens. My Code snippet as follows. websocket.js : var stompClient = null; function connect( temp ) { alert(temp); //var socket = new SockJS("/websock"); //var socket = new SockJS("/websock"+temp); var socket = new SockJS(context_path+"/websock"+temp); //context_path == "/SupportCenter" stompClient = Stomp.over(socket); stompClient

SockJs - 'info' path not found

£可爱£侵袭症+ 提交于 2019-12-01 11:31:21
I'm running an example of SockJS . Ran npm install (everything okay) Start server with no problem. When I first load the test page , I see that there was a failed 404 call to http://127.0.0.1/echo/info I'm looking at sockjs code and I'm guessing it is called from here - https://github.com/sockjs/sockjs-node/blob/master/src/sockjs.coffee#L81 What is the purpose of this info call and why is it not found? What am I missing in my configuration? Your server is listening on 9999 port! So you have to put the port too. This will work http://127.0.0.1:9999/echo/info 来源: https://stackoverflow.com

Is there a way to do a tcp connection to an IP with javascript?

ⅰ亾dé卋堺 提交于 2019-12-01 05:58:17
Let me give a little background on what I am trying to accomplish. I have a device(chip and pin Terminal) that has a local IP address, It has been programmed to receive certain data and process it. example: I send the string "05" in hex "30 35" and the terminal reads that and will restart. I have tried using SockJS-Client as well as the built in WebSockets . However using Websockets I notice that the browser is sending: GET / HTTP/1.1 Host: IP:PORT Connection: Upgrade Pragma: no-cache Cache-Control: no-cache Upgrade: websocket Origin: MYIP Sec-WebSocket-Version: 13 User-Agent: Mozilla/5.0

Is there a way to do a tcp connection to an IP with javascript?

假装没事ソ 提交于 2019-12-01 03:02:40
问题 Let me give a little background on what I am trying to accomplish. I have a device(chip and pin Terminal) that has a local IP address, It has been programmed to receive certain data and process it. example: I send the string "05" in hex "30 35" and the terminal reads that and will restart. I have tried using SockJS-Client as well as the built in WebSockets. However using Websockets I notice that the browser is sending: GET / HTTP/1.1 Host: IP:PORT Connection: Upgrade Pragma: no-cache Cache

解决vue@cli3不停请求 /sockjs-node/info?t= 问题

☆樱花仙子☆ 提交于 2019-12-01 02:20:57
使用cli3会遇到一直报错get不到/sockjs-node/info?t= 的问题: 如果你的项目没有用到 sockjs,那么就找到报错的地方,将其注释掉即可。 路径在/node_modules/sockjs-client/dist/sockjs.js,第1606行: 然后刷新一下即可。 来源: https://www.cnblogs.com/dxy9527/p/11647701.html

Header in the response must not be the wildcard '*' when the request's credentials mode is 'include'

给你一囗甜甜゛ 提交于 2019-11-30 10:50:01
I'm using Auth0 for my user authentication to only allow logged in users to access a Spring (Boot) RestController . At this point I'm creating a real-time message functionality where users can send messages from the Angular 2 client ( localhost:4200 ) to the Spring server (localhost:8081) using stompjs and sockjs . When trying to create a Stomp-client and starting a connection I receive the following console-error: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://localhost:4200'