dynamic ws/wss selection

This commit is contained in:
Blake Blackshear 2021-02-20 08:11:58 -06:00
parent 4a74f295e7
commit 31d408a746

View File

@ -34,7 +34,7 @@ export function MqttProvider({
config, config,
children, children,
createWebsocket = defaultCreateWebsocket, createWebsocket = defaultCreateWebsocket,
mqttUrl = `${baseUrl.replace(/^https?:/, 'ws:')}/ws`, mqttUrl = `${baseUrl.replace(/^http/, 'ws')}/ws`,
}) { }) {
const [state, dispatch] = useReducer(reducer, initialState); const [state, dispatch] = useReducer(reducer, initialState);
const wsRef = useRef(); const wsRef = useRef();