GithubHelp home page GithubHelp logo

关于wss 协议的发布 about freeim HOT 13 CLOSED

2881099 avatar 2881099 commented on July 23, 2024
关于wss 协议的发布

from freeim.

Comments (13)

2881099 avatar 2881099 commented on July 23, 2024

#11

from freeim.

2881099 avatar 2881099 commented on July 23, 2024

#3

from freeim.

2881099 avatar 2881099 commented on July 23, 2024

wss 他 imcore im 没有绑定关系,wss 参考 https aspnetcore 配置的教程就好了。

from freeim.

lauralxj avatar lauralxj commented on July 23, 2024

谢谢回复
现在的场景如下:
1.终端是小程序
2.web api 是.net framework 4.5
3.按照昨天您提示的我发布了ImServer.exe
4.IP连接没有问题,ImServer.exe 这怎么绑定域名啊,感谢

from freeim.

2881099 avatar 2881099 commented on July 23, 2024

ImServer.exe 这怎么绑定域名

    public class Program
    {
        public static void Main(string[] args)
        {
            var host = new WebHostBuilder()
                .UseKestrel(option=> {
                    option.UseHttps("server.pfx", "linezero");
                })
                .UseUrls("https://www.baidu.com:443")
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()
                .UseStartup<Startup>()
                .Build();

            host.Run();
        }
    }

from freeim.

2881099 avatar 2881099 commented on July 23, 2024

websocket 不限制端口号,小程序可以用 wss://www.baidu.com:6001 连接

from freeim.

2881099 avatar 2881099 commented on July 23, 2024
            .UseKestrel(option=> {
                option.UseHttps("server.pfx", "linezero");
            })
            .UseUrls("https://www.baidu.com:443")

这两个配置是关键,其他资料可以到百度搜索:aspnetcore https 配置

from freeim.

lauralxj avatar lauralxj commented on July 23, 2024

可以理解为把ImServer下的Program文件增加

.UseKestrel(option=> {

            option.UseHttps("server.pfx", "linezero");
        })
        .UseUrls("https://www.baidu.com:443")'

如上代码,ImServer可以部署在iis上,由iIS承载吗?

from freeim.

2881099 avatar 2881099 commented on July 23, 2024

不用挂载,独立运行

from freeim.

lauralxj avatar lauralxj commented on July 23, 2024

搞不定,崩溃:

Startup.cs
app.UseImServer(new ImServerOptions { Redis = new CSRedis.CSRedisClient("127.0.0.1:6379,poolsize=5"), Servers = new[] { "39.243.73.68:8080" }, Server = "39.243.73.68:8080" });

Program.cs
WebHost.CreateDefaultBuilder(args) .UseKestrel(options => { options.Listen(IPAddress.Loopback, 8080, listenOptions => { listenOptions.UseHttps("message.pfx", "9874321"); }); }) .UseUrls("https://www.baidu.com:8080") .UseStartup<Startup>();
预连接代码,ws调整为wss
public string PrevConnectServer(Guid clientId, string clientMetaData) { var server = SelectServer(clientId); var token = $"{Guid.NewGuid()}{Guid.NewGuid()}{Guid.NewGuid()}{Guid.NewGuid()}".Replace("-", ""); _redis.Set($"{_redisPrefix}Token{token}", JsonConvert.SerializeObject((clientId, clientMetaData)), 10); return $"wss://{server}{_pathMatch}?token={token}"; }
结果报错如下:

以一种权限不允许的方式做了一个访问套接字的尝试
网上说是端口占用的问题,更改后依然报此错误。
期待帮助,谢谢!

from freeim.

2881099 avatar 2881099 commented on July 23, 2024

实在弄不好的话,就用 http 转发吧,把其他 https 的服务器转发给这里。就不用在这里配置 ssl 了

from freeim.

2881099 avatar 2881099 commented on July 23, 2024

方便留个交流方式或者建个群不,付费指导也行啊,发了二天时间了搞不定,今天才发现API获取ws url后根本连接不上。
QQ:18477899

加你了,等通过

from freeim.

lauralxj avatar lauralxj commented on July 23, 2024

结贴,在作者的远程指导下终于连线成功,抽时间整理一下发出来,避免其它使用者再走弯路,感谢!

from freeim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.