Paul Krill
Editor at Large

Ktor 3.0 switches to kotlinx.io library

news
Oct 11, 20242 mins

The Kotlin-based framework also backs server-sent events and adds WebAssembly as a build target for the Ktor client.

A large, three-dimensional numeral three is extruded from a dark grey carbon fiber background.
Credit: bgblue / Getty Images

Ktor 3.0, the latest version of the Kotlin-based framework for building asynchronous client- and server-side applications, is now available. Ktor 3.0 switches to the kotlinx.io library for handling data sources. The release also highlights support for server-sent events (SSE).

The JetBrains Ktor 3.0 technology, announced October 10, can be accessed from start.ktor.io. The biggest change in version 3.0 is the switch to the kotlinx.io multiplatform library. This library offers a multiplatform API that can handle data sources and provides capabilities including working with files, using compression, and more. The kotlinx.io library also cuts down on unnecessary copying of bytes between ByteReadChannel, ByteWriteChannel, and network interfaces. This allows for more efficient byte transformations and parsing, thus making room for future performance improvements.

SSE is also now supported for both the server and the client. With SSE, servers push clients over an HTTP connection and SSE provides a one-way communication channel. This approach is useful for scenarios where the server needs to send event-based updates without needing the client to repeatedly poll for new information.

Elsewhere in Ktor 3.0:

  • WebAssembly now is supported as a build target by the Ktor client.
  • Support for cross-site request forgery (CSRF) protection was added with the new plugin.
  • A new staticZip function lets users serve the contents of a ZIP archive as static content.
  • Breaking changes affect low-level IO APIs, including classes such as Input, Output, and ByteReadChannel. Developers using these classes directly will see deprecation warnings.
Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author