在SignalR Core中将Http与WebSocket同时使用

时间:2018-07-19 08:05:58

标签: .net asp.net-core .net-core signalr asp.net-core-signalr

是否可以同时将Http和WebSocket一起使用。因此,在我的情况下,我想首先发送初始Http请求以从服务器获取一些数据,然后将协议与WebSocket连接。当我尝试在Asp.Net核心中执行此操作时,我只会收到一个错误:

  

无法加载资源:net :: ERR_SPDY_PROTOCOL_ERROR

首先,我要请求获取数据:

import { takeEvery, put, select } from 'redux-saga/effects'
import { changeListParams } from 'react-admin'
import { SET_IS_PUBLISHED } from './isPublished'

const getCurrentListParams = (state, resource) => {
    const resourceState = state.admin.resources[resource]
    return resourceState.list.params
}

function handleSetPublished({ payload }) {
    const currentParams = yield select(getCurrentListParams)
    const newParams = {
        // Keep the current params
        ...currentParams,
        // Override the filter
        filter: {
            // Keep the current filter
            ...currentParams.filter,
            // Only override the is_published
            is_published: payload
        }
    }
    // Dispatch the action for the `posts` resource
    yield put(changeListParams('posts', newParams))
}

export default function* () {
    yield takeEvery(SET_IS_PUBLISHED, handleSetPublished)
}

然后:

$.ajax({
        dataType: "json",
        url: "/notification/unreadnotificatons/",
        method: "GET",
        success: function (response) {
            if (response != null)
                filterForNew(response);
        }
    });

在那之后,我什至无法重新加载从未加载过的页面。有人解决这种问题吗?

0 个答案:

没有答案