Given an m x n matrix of integers, write a function that traverses the matrix in spiral order (starting at the top-left corner and moving clockwise inward) and returns the sum of all visited elements.
For instance, given the following matrix:
[ [1, 2, 3],
[4, 5, 6],
[7, 8, 9] ]
The spiral order traversal is: 1, 2, 3, 6, 9, 8, 7, 4, 5, and the function should return the sum which is 45.
Implement your solution in your preferred programming language.