简体   繁体   English

WebSocket转Ldap

[英]WebSocket to Ldap

I am trying to etablish a websocket connection to an ldap server. 我正在尝试建立与ldap服务器的websocket连接。 That I can simply send binary data to and receive binary data. 我可以简单地将二进制数据发送到并接收二进制数据。 But it fails on the handshake whatever I do. 但是无论我做什么,握手都会失败。

var socket = new WebSocket("ws://ads.de:PORT")

Yours sincerely Skeec 您真诚的Skeec

Web sockets is a specific protocol, like HTTP, and it has "nothing" to do with a TCP/UPD socket. Web套接字是一个特定的协议,例如HTTP,它与TCP / UPD套接字没有任何关系。
You cannot connect with web-sockets to an LDAP-server, let alone connect to a different domain without receiving the appropriate CORS http-headers (and the browser supporting CORS). 您无法使用网络套接字连接到LDAP服务器,更不用说连接到其他域而不接收适当的CORS HTTP标头(和支持CORS的浏览器)。

You need to write a proxy WebSocket server application so that you can communicate with the LDAP-directory. 您需要编写一个代理WebSocket服务器应用程序,以便可以与LDAP目录通信。 You cannot do it in JavaScript (unless you want to use an ActiveX object, which will be incompatible with non-Microsoft browsers (and newer Microsoft browsers). 您无法使用JavaScript进行此操作(除非您想使用ActiveX对象,该对象将与非Microsoft浏览器(和较新的Microsoft浏览器)不兼容。

You better do it with plain-old AJAX with an asynchronous handler. 您最好使用带有异步处理程序的普通AJAX来实现。
You don't need WebSockets for that, you're only wasting bandwidth. 您不需要WebSockets,只浪费带宽。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM