why client credentials not found ?
Closed this issue · 1 comments
wideweide commented
centrifuge server version: 3.2.0
Nodejs 18.16:
centrifuge 2.8.5 with sockjs work well
const Centrifuge = require('centrifuge');
const SockJS = require('sockjs-client');
const url = 'http://*.com:8213';
const centrifugoToken = '***';
const centrifuge = new Centrifuge(`${url}/centrifugo/connection/sockjs`, {
transport: SockJS,
sockjs: SockJS
});
centrifuge.setToken(centrifugoToken);
centrifuge.connect();
centrifuge 3.1.2 with websokcet failed
const { Centrifuge } = require('centrifuge'); // 3.1.2
const WebSocket = require('ws');
const centrifuge = new Centrifuge(url, {
token: centrifugoToken,
websocket: WebSocket,
});
the console show
Connecting: 0, connect called
Disconnected: 3501, bad request
server log
{"level":"info","client":"de69b4c4-a77a-400d-aa18-fb33f33ef28f","user":"","time":"2024-07-04T17:18:16+08:00","message":"client credentials not found"}
{"level":"info","client":"de69b4c4-a77a-400d-aa18-fb33f33ef28f","command":"id:1 connect:{token:\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI1NyIsImNoYW5uZWxzIjpbInB1YmxpYzpwbXM6Il0sImV4cCI6MTcyMDY4ODAzNn0.hZ5CnMtjK9XW5kWCl6zkNIvR9fChaVniAw8Z5y-0kKg\" name:\"js\"}","reason":"bad request","user":"","time":"2024-07-04T17:18:16+08:00","message":"disconnect after handling command"}
FZambia commented
Hello! centrifuge-js >= v3.0.0 works only with Centrifugo v4. See https://centrifugal.dev/docs/4/getting-started/migration_v4#client-sdk-migration