Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Winform的ClientWebSocket始终联不上 #29

Open
loryrichie opened this issue Dec 8, 2020 · 18 comments
Open

Winform的ClientWebSocket始终联不上 #29

loryrichie opened this issue Dec 8, 2020 · 18 comments

Comments

@loryrichie
Copy link

ClientWebSocket client = new ClientWebSocket();
client.ConnectAsync(new Uri("ws://127.0.0.1:6001/ws?token=f5e2fdf65e5c4a1f9fc677c8a3e6b99ccd35347169084455a33d01af3fc350ba728e58799bc6434e8c3b9e82b206eddaa4a88d85150b4315856a5e6ecfd3543a"), CancellationToken.None).Wait() ;

联不上。不知道什么原因,求大佬 指点

@2881099
Copy link
Owner

2881099 commented Dec 8, 2020

token 是从服务端接口获取的吗

@loryrichie
Copy link
Author

是的

@2881099
Copy link
Owner

2881099 commented Dec 8, 2020

127.0.0.1 6001 是什么服务

@loryrichie
Copy link
Author

loryrichie commented Dec 8, 2020

string urls = "http://localhost:47205/ws/pre-connect";
string result=HttpHelper.PostRequest(urls);
ServerModel server= JsonConvert.DeserializeObject(result);
websockedid = server.websocketId;
ClientWebSocket client= new ClientWebSocket();
client.ConnectAsync(new Uri(server.server), CancellationToken.None).Wait(20) ;

@loryrichie
Copy link
Author

127.0.0.1 6001 是什么服务

6001是通过weiapi获取到的

@2881099
Copy link
Owner

2881099 commented Dec 8, 2020

imserver 启动是用 127.0.0.1:6001 吗

@loryrichie
Copy link
Author

imserver 启动是用 127.0.0.1:6001 吗

启动的时候显示:127.0.0.1:5000

@loryrichie
Copy link
Author

image

@loryrichie
Copy link
Author

我也很不解,在imserver里配置的 6001 ,怎么启动的时候就变5000了

@2881099
Copy link
Owner

2881099 commented Dec 8, 2020

imserver 启动参数

—urls=http://127.0.0.1:6001

webapi, imserver 配置值 server 值都是 127.0.0.1:6001

webapi, imserver 的 redis 配置一样

imserver 的配置 servers 也配置成 127.0.0.1:6001

@loryrichie
Copy link
Author

imserver 启动参数

—urls=http://127.0.0.1:6001

webapi, imserver 配置值 server 值都是 127.0.0.1:6001

webapi, imserver 的 redis 配置一样

imserver 的配置 servers 也配置成 127.0.0.1:6001

好的,谢谢大佬 ,我再重新弄下。

@loryrichie
Copy link
Author

loryrichie commented Dec 9, 2020

image
这张 图,显示的是5000,其实是6001,本机telnet 5000是不成功的,6001是成功 的,为什么要这么显示呢,有点奇怪

@loryrichie
Copy link
Author

查了资料如果不指定端口,这里默认显示5000,原来是MS搞的

@loryrichie
Copy link
Author

winform 还是连不上

@2881099
Copy link
Owner

2881099 commented Dec 9, 2020

是什么提示?

@loryrichie
Copy link
Author

是什么提示?

connecting 然后超时

@2881099
Copy link
Owner

2881099 commented Dec 9, 2020

那就是连不上 imserver

@1031918012
Copy link

image
我昨天遇到了类似的问题,再配置文件中配一下Urls启动站点之后就好了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants