我在websocket握手期间遇到了错误。 Firefox无法在ws:// localhost:8082 / FetchNotification / NewFile.htmlatpendpoint建立与服务器的连接 是否有人遇到同样的问题。 我已经提到了代码 https://dzone.com/articles/wso2-products-resolving-err-ssl-weak-ephemeral-dh
答案 0 :(得分:1)
如果对WebSocket端点的请求正确,则端点返回" 101 Switching Protocols"。否则,端点将返回正常的HTTP响应。
你应该解释你得到的404错误。也就是说,URL的路径部分是错误的并且找不到(404 Not Found)。
答案 1 :(得分:0)
您应该用于函数调用的URL
use strict;
use warnings;
use DBI;
# ...
# the columns
my $colsf = join ',', @some_list_of_column_names; # also check those!
# the table name
my $table = $q->param('table');
die 'invalid table name' if $table =~ /[^a-zA-Z0-9_]/; # input checking
# where
# I'm skipping this part as I don't know where it is comming from
if ($op eq 'SELECT') {
my $sql = 'SELECT $colsf FROM $table';
$sql .= ' WHERE $whr' if $whr;
my $sth = $dbh->prepare($sql) or die $dbi->errstr;
$sth->execute;
my @headings = $sth->{NAME}; # see https://metacpan.org/pod/DBI#NAME1
while (my $res = $sth->fetchrow_hashref) {
# do stuff here
}
}
相反,如果您使用的变量如Echo.connect(“ws://”+ host +“/ NewFile.html”),请确保它是/FetchNotification/NewFile.html而不是
否则在websocket Endpoint中确保上面的url是你用于
的urlEcho.connect("ws://localhost:8082/FetchNotification/NewFile.html")