```
Я пытался использовать CkEditor5, чтобы заставить работать в режиме реального времени. Получение сообщения об ошибке: недопустимый токен и ошибка подключения к Websocket
ClassicEditor.create(document.querySelector('#editor'), {
initialData: '<p>Let\'s edit this together!</p>',
toolbar: ['bold', 'italic', 'imageUpload'],
plugins: ['Essentials', 'Paragraph', 'Bold', 'Italic', 'RealTimeCollaborativeEditing', 'PresenceList', 'RealTimeCollaborativeTrackChanges', 'RealTimeCollaborativeComments'],
cloudServices: {
// PROVIDE CORRECT VALUES HERE:
tokenUrl: 'http://localhost:54269/Student/RealTimeAssignment/token',
uploadUrl: 'https://71044.cke-cs.com/easyimage/upload/',
webSocketUrl: '71044.cke-cs.com/ws'
},
collaboration: {
channelId: $('#assId').val()
},
presenceList: {
container: document.querySelector('#presence-list-container'),
collapseAt: 3,
//onClick: ( user, element ) => console.log( user, element )
}
})
.catch(error => console.error(error));
//Here is my token generation code--
var securityKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(secretKey));
var signingCredentials = new SigningCredentials(securityKey, "HS256");
var header = new JwtHeader(signingCredentials);
var dateTimeOffset = new DateTimeOffset(DateTime.UtcNow);
var payload = new JwtPayload
{
{ "aud", environmentId },
{ "iat", dateTimeOffset.Ticks },
{ "sub", _userid.ToString() },
{ "user", new Dictionary<string, string> {
{ "email", email },
{ "name", name }
} },
{ "auth", new Dictionary<string, object> {
{ "collaboration", new Dictionary<string, object> {
{ "*", new Dictionary<string, string> {
{ "role", "writer" }
} }
} }
} }
};
var securityToken = new JwtSecurityToken(header, payload);
var handler = new JwtSecurityTokenHandler();
return handler.WriteToken(securityToken);```