RepetierSharp 0.1.5

.NET 5.0 .NET Core 3.1
Install-Package RepetierSharp -Version 0.1.5
dotnet add package RepetierSharp --version 0.1.5
<PackageReference Include="RepetierSharp" Version="0.1.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RepetierSharp --version 0.1.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RepetierSharp, 0.1.5"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install RepetierSharp as a Cake Addin
#addin nuget:?package=RepetierSharp&version=0.1.5

// Install RepetierSharp as a Cake Tool
#tool nuget:?package=RepetierSharp&version=0.1.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

RepetierSharp - A simple, event driven Repetier Server client


RepetierSharp is a simple, event-driven client which encapsulates the WebSocket API (as well as the REST API where needed) to control the Repetier Server.

What is Repetier Server?

"Repetier-Server is the professional all-in-one solution to control and manage your 3d printers and to get the most out of it."


This library is build against and tested with RepetierServer version 1.2.0. The serialization for most commands and events should be working with earlier versions, but there is the possibilty of crashes when using RepetierSharp with earlier versions due to undocumented changes.

Note that you are still able to use RepetierSharp by just using the version independent event handlers for events and command responses: OnRawEvent(string eventName, string printer, byte[] payload) and OnRawResponse(int callbackID, string command, byte[] response) respectively.

Framework support

Currently RepetierSharp supports .NET Core 3.1, .NET 5 and .NET 6.


I quite enjoy using the Repetier Server software to control/manage our 3d printers. But I could not find any client implementing the Repetier Server API. This was needed because I wanted to control the Repetier Server programmatically to automate certain tasks.

Repetier Server API

Getting started

DISCLAIMER: RepetierSharp is still in beta. Bugs are to be expected - please bear with me and help improving RepetierSharp by submitting issues on GitHub.

The following sections show some examples on how to use the RepetierSharp client. The examples are not exhaustive. I will try to write a more thourough documentation as soon as possible.

RepetierSharp uses a fluent builder api to reduce the complexity when creating a new client instance.

Establish a connection

Simply start by creating an instance of the RepetierConnection class. To establish a connection it is possible to provide the Repetier Server API-Key or user credentials.

The most basic configuration to setup a working RepetierConnection looks like this:

RepetierConnection rc = new RepetierConnectionBuilder()
	.WithHost("", 4000)


This gives you access to the repetier server with the global user profile.

In most cases you would want to create a connection by suppling a API-Key or user credentials:

Example using user credentials:

RepetierConnection rc = new RepetierConnectionBuilder()
	.WithCredentials("user", "password", rememberSession: true)


Example using a Repetier Server API-Key:

RepetierConnection rc = new RepetierConnectionBuilder()
	.WithHost("", 4000)


When both, API-Key and user credentials are supplied, the last option will be used.

More examples

Create a connection, register an event handler for successfull connection, which activates the printer with the slug "Delta" and enqueues and starts the job with the id 6.

RepetierConnection rc = new RepetierConnectionBuilder()
	.WithHost("", 4000)

rc.OnRepetierConnected += () =>



The following commands and events are named after the Repetier Server commands/events from the API documentation At the moment RepetierSharp supports the following features:


To get notified about repetier events it is possible to register and event handler like this:

rc.OnEvent += (eventName, printer, eventData) => 
	// handle event

Where eventData is a IRepetierEvent instance. The eventName can be used to determine the event and cast the event data to the corresponding type provided in the RepetierSharp namespace.

At the moment the following repetier events are supported:

<details> <summary>[Click to expand the list of supported events]</summary>

  • timerX
  • loginRequired
  • userCredentials
  • printerListChanged
  • messagesChanged
  • jobFinished
  • jobKilled
  • jobStarted
  • eepromData
  • state
  • config
  • firmwareChanged
  • temp
  • printerSettingChanged
  • jobsChanged
  • logout
  • printQueueChanged
  • foldersChanged
  • eepromClear
  • modelGroupListChanged
  • prepareJob
  • prepareJobFinished
  • changeFilamentRequested
  • remoteServersChanged
  • getExternalLinks </details>

Since there are many events and serialization for all events is still not implemented RepetierSharp also provides an event handler for the raw event data:

rc.OnRawEvent += (eventName, printer, eventData) => 
	// handle eventData

Where eventData is of type byte[] and contains the data from the data field of the event from original json sent by the server (see documentation).


To get responses for the sent commands it is possible to register event handler similar as for the events:

rc.OnResponse += (callbackId, command, response) =>
	// handle response

Where callbackId is the id corresponding to the sent command, command is the name of the command and response of the type IRepetierMessage is the actual response data. This data can be cast to the corresponding type by determining the command and using the provided types within the namespace - analogous to the events.

At the moment the following commands (inclusive responses) are suppored:

<details> <summary>[Click to expand the list of supported commands]</summary>

  • login
  • logout
  • listPrinter
  • stateList
  • messages
  • listModels
  • listJobs
  • modelInfo
  • jobInfo
  • removeJob
  • send
  • copyModel
  • emergencyStop
  • activate
  • deactivate
  • updateUser
  • createUser
  • deleteUser
  • userList
  • startJob
  • stopJob
  • continueJob </details>

Analogous to the events there are many commands and serialization for all is not yet implemented. Therefore RepetierSharp also provides an event handler for the raw command response data:

rc.OnRawResponse += (callbackId, command, responseData) => 
	// handle command response

Where responseData is of type byte[] and contains the data from the data field of the command from original json sent by the server (see documentation).


Additionally there are some functions levering the REST-API directly:

  • To start a print directly use:
rc.UploadAndStartPrint("/path/to/gcode/file.gcode", "printerSlug");
  • or just upload a gcode file by using:
rc.UploadGCode("/path/to/gcode/file.gcode", "group", "printerSlug");

Event handler

Beside the already discussed event handlers for events and command responses there are some additional implemented handlers for common used events (to reduces the effort of checking for these events and casting the data):

  • OnLogReceived
  • OnJobFinishedReceived
  • OnJobStartedReceived
  • OnJobKilledReceived
  • OnJobsChanged
  • OnPrinterStateReceived
  • OnTempChangeReceived
  • OnPrinterListChanged
  • OnPrinterSettingsChanged
  • OnUserCredentialsReceived
  • OnLoginRequired
  • OnMessagesReceived
  • OnLoginReceived
  • OnPrinterListReceived
  • OnModelListReceived
  • OnModelInfoReceived
  • OnJobInfoReceived
  • OnJobListReceived

Cyclic command execution

The Repetier Server web interface uses some commands to cyclic query information from the server. The same is possible with RepetierSharp:

RepetierConnection rc = new RepetierConnectionBuilder()
	.WithHost("", 4000)

In lines 4 and 5 a cyclic call is added to query the printers and the printer status respectively. The RepetierTimer parameters correspond to the timer events of the Repetier server. The Timer30 event is triggered every 30 seconds, the Timer60 event every 60 seconds. This puts the queries in a queue whose contents are executed each time the corresponding event is triggered by the server.

Additionaly there is also a method to add any other commands to these command queues:

RepetierConnection rc = new RepetierConnectionBuilder()
	.WithHost("", 4000)
	.WithCyclicCommand(RepetierTimer.Timer3600, UpdateAvailableCommand.Instance)

In line 4 the command updateAvailable is added to the 1 hour timer queue so every hour RepetierSharp queries if there is a update for the Repetier Server available.




The goal for this project is to add most (or even all) used WebSocket commands and events provided by the Repetier Server API to enable a full programmatic control of the Repetier Server.

There are also some events and commands that are not documented in the API - with some time and effort, I will try to reconstruct these and integrate them into RepetierSharp.

There is also a MQTT client using this library, to forward the events and command responses to a configurable broker.


TODO: Issue/bug template

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp3.1
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on RepetierSharp:

Package Downloads

RepetierMqtt is a small and simple MQTT client which leverages the RepetierSharp client to forward information from the Repetier Server API to MQTT. It also provides the possibility to send commands via MQTT to the Repetier Server as well as upload and start gcode files.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.5 98 2/9/2022
0.1.4 76 2/8/2022
0.1.3 128 2/3/2022
0.1.2 82 2/3/2022
0.1.1 87 2/2/2022
0.1.0 86 2/2/2022