I'm new to SignalR. I have a jQuery code below, which allows to connect to the hub successfully. Now I need to subscribe to an event, lets just say, someEvent. How can I do that? Transport type according to logs: serverSentEvents. By the way, server side code is a black box for me, I have only name of the event...

var hub = $.hubConnection("https://someurl/"); 

hub.logging = true;
hub.start()
    .done(function () {        
        console.log(`Connected... Hub id: ${hub.id}`);
        console.log("Transport = " + hub.transport.name);
    
        console.log(hub);        
    })
    .fail(function (err) {
        console.log(`Not connected: ${err}`);
    });

Here are a couple common uses cases and examples

Handle Server Methods / Remote Procedure Call

If you'd like to listen for the method addContosoChatMessageToPage, you can do it like this:

var connection = $.hubConnection();
var contosoChatHubProxy = connection.createHubProxy('contosoChatHub');
contosoChatHubProxy.on('addContosoChatMessageToPage', function(name, message) {
    console.log(name + ' ' + message);
});

Handle Connection Lifetime Events

If you'd like to listen for a lifecycle event like starting or connectionSlow you can do it like this:

$.connection.hub.connectionSlow(function () {
    console.log('We are currently experiencing difficulties with the connection.')
});

Send Message to server

If you want to post a message back to the server hub, you can do it like this:

var contosoChatHubProxy = $.connection.contosoChatHub;

$.connection.hub.start().done(function () {
    // Wire up Send button to call NewContosoChatMessage on the server.
    $('#newContosoChatMessage').click(function () {
         contosoChatHubProxy.server.newContosoChatMessage($('#displayname').val(), $('#message').val());
         $('#message').val('').focus();
     });
});

Further Reading

Check out the docs on using the Hub API on the Client in Javascript - they're actually quite good