We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I use the Spring framework to implement data reception
Kotlin
@MessageMapping("/upload") fun upload(@Payload fileData: ByteArray?): Mono<String> { println("========= OK") println("========= OK "+ fileData!!.size) val uploadFile = File("/Users/Downloads/uploaded_file.png") // return Mono.just("ok") return Mono.just("ok").doOnSuccess { try { FileOutputStream(uploadFile).use { fos -> fos.write(fileData!!) } } catch (e: IOException) { e.printStackTrace() } } }
I use srocket js to upload files
upload(file) { let route = encodeRoute("/upload"); let compositeMetaData = encodeCompositeMetadata([ [WellKnownMimeType.MESSAGE_RSOCKET_ROUTING, route] ]); const reader = new FileReader(); reader.onload = (event) => { let result = event.target.result as ArrayBuffer; console.log(result) this.socket.requestResponse({data: Buffer.from(result), metadata: compositeMetaData}, { onComplete(): void { }, onError(error: Error): void { console.error("Error", error); }, onExtension(extendedType: number, content: Buffer | null | undefined, canBeIgnored: boolean): void { }, onNext(payload: Payload, isComplete: boolean): void { console.log("OK", isComplete); console.log("payload", payload.data); } }) } reader.readAsArrayBuffer(file); }
Result:
When receiving 130KB, it is possible, but there is an error if it is greater than 130Kb
Please provide an example program to tell me what to do
This image only has a portion
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I use the Spring framework to implement data reception
Kotlin
I use srocket js to upload files
Result:
When receiving 130KB, it is possible, but there is an error if it is greater than 130Kb
Please provide an example program to tell me what to do
This image only has a portion
The text was updated successfully, but these errors were encountered: