Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 33x 33x 33x 33x 33x 1x 33x 2x 2x 2x | import { System } from 'cafe-utility' import WebSocket from 'isomorphic-ws' import { BeeRequestOptions, UploadOptions } from '..' import { SingleOwnerChunk, uploadSingleOwnerChunk } from '../chunk/soc' import { BatchId, Reference } from '../utils/typed-bytes' const endpoint = 'gsoc' export async function send( requestOptions: BeeRequestOptions, soc: SingleOwnerChunk, stamp: BatchId, options?: UploadOptions, ) { return uploadSingleOwnerChunk(requestOptions, soc, stamp, options) } export function subscribe(url: string, reference: Reference, headers?: Record<string, string>) { const wsUrl = url.replace(/^http/i, 'ws') Iif (System.whereAmI() === 'browser') { return new WebSocket(`${wsUrl}/${endpoint}/subscribe/${reference.toHex()}`) } return new WebSocket(`${wsUrl}/${endpoint}/subscribe/${reference.toHex()}`, { headers, }) } |